Added some UI niceness (connect/disconnect thing in Grid menu)
parent
338ef1473d
commit
401004ea64
|
@ -10,6 +10,7 @@ namespace OpenGridServices.Manager
|
|||
{
|
||||
private string ServerURL;
|
||||
public LLUUID SessionID;
|
||||
public bool connected=false;
|
||||
|
||||
public bool Connect(string GridServerURL, string username, string password)
|
||||
{
|
||||
|
@ -23,14 +24,17 @@ namespace OpenGridServices.Manager
|
|||
XmlRpcRequest GridLoginReq = new XmlRpcRequest("manager_login",LoginParams);
|
||||
XmlRpcResponse GridResp = GridLoginReq.Send(ServerURL,3000);
|
||||
if(GridResp.IsFault) {
|
||||
connected=false;
|
||||
return false;
|
||||
} else {
|
||||
Hashtable gridrespData = (Hashtable)GridResp.Value;
|
||||
this.SessionID = new LLUUID((string)gridrespData["session_id"]);
|
||||
connected=true;
|
||||
return true;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
Console.WriteLine(e.ToString());
|
||||
connected=false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +56,7 @@ namespace OpenGridServices.Manager
|
|||
if(GridResp.IsFault) {
|
||||
return false;
|
||||
} else {
|
||||
connected=false;
|
||||
return true;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
|
@ -60,5 +65,9 @@ namespace OpenGridServices.Manager
|
|||
}
|
||||
}
|
||||
|
||||
public void DisconnectServer()
|
||||
{
|
||||
this.connected=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace OpenGridServices.Manager
|
|||
win.SetStatus("Connecting to grid server...");
|
||||
if(gridserverConn.Connect(operation.Split(sep)[1],operation.Split(sep)[2],operation.Split(sep)[3])) {
|
||||
win.SetStatus("Connected OK with session ID:" + gridserverConn.SessionID);
|
||||
win.SetGridServerConnected(true);
|
||||
Thread.Sleep(3000);
|
||||
win.SetStatus("");
|
||||
} else {
|
||||
|
@ -63,12 +64,18 @@ namespace OpenGridServices.Manager
|
|||
win.SetStatus("Shutting down grid server...");
|
||||
if(gridserverConn.ShutdownServer()) {
|
||||
win.SetStatus("Grid server shutdown");
|
||||
win.SetGridServerConnected(false);
|
||||
Thread.Sleep(3000);
|
||||
win.SetStatus("");
|
||||
} else {
|
||||
win.SetStatus("Could not shutdown grid server!!!");
|
||||
}
|
||||
break;
|
||||
|
||||
case "disconnect_gridserver":
|
||||
gridserverConn.DisconnectServer();
|
||||
win.SetGridServerConnected(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,17 @@ namespace OpenGridServices.Manager {
|
|||
this.statusbar1.Push(0,statustext);
|
||||
}
|
||||
|
||||
public void SetGridServerConnected(bool connected)
|
||||
{
|
||||
if(connected) {
|
||||
this.ConnectToGridserver.Visible=false;
|
||||
this.DisconnectFromGridServer.Visible=true;
|
||||
} else {
|
||||
this.ConnectToGridserver.Visible=true;
|
||||
this.DisconnectFromGridServer.Visible=false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
|
||||
{
|
||||
Application.Quit ();
|
||||
|
@ -32,7 +43,6 @@ namespace OpenGridServices.Manager {
|
|||
{
|
||||
ConnectToGridServerDialog griddialog = new ConnectToGridServerDialog ();
|
||||
griddialog.Show();
|
||||
|
||||
}
|
||||
|
||||
protected virtual void RestartGridserverMenu(object sender, System.EventArgs e)
|
||||
|
@ -45,6 +55,11 @@ namespace OpenGridServices.Manager {
|
|||
MainClass.PendingOperations.Enqueue("shutdown_gridserver");
|
||||
}
|
||||
|
||||
protected virtual void DisconnectGridServerMenu(object sender, System.EventArgs e)
|
||||
{
|
||||
MainClass.PendingOperations.Enqueue("disconnect_gridserver");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -355,6 +355,7 @@ namespace OpenGridServices.Manager {
|
|||
this.ExitGridManager.Activated += new System.EventHandler(this.QuitMenu);
|
||||
this.ShutdownGridserverOnly.Activated += new System.EventHandler(this.ShutdownGridserverMenu);
|
||||
this.RestartGridserverOnly.Activated += new System.EventHandler(this.RestartGridserverMenu);
|
||||
this.DisconnectFromGridServer.Activated += new System.EventHandler(this.DisconnectGridServerMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
<property name="ShortLabel" translatable="yes">Disconnect from grid server</property>
|
||||
<property name="StockId">gtk-disconnect</property>
|
||||
<property name="Visible">False</property>
|
||||
<signal name="Activated" handler="DisconnectGridServerMenu" after="yes" />
|
||||
</action>
|
||||
<action id="UploadAsset">
|
||||
<property name="Type">Action</property>
|
||||
|
|
Loading…
Reference in New Issue