mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
When we end the connection call OnConnectionClosed instead of OnConnectionStateChanged.
This avoids firing the ConnectionClosed event explicitly after EndConnect; it also avoids refreshing explicitly the tree as the main Window handles the ConnectionClosed event which requests a refresh. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
be0176afe0
commit
c3fcffa236
@ -156,7 +156,6 @@ namespace XenAdmin.Commands
|
|||||||
XenDialogBase.CloseAll(connection);
|
XenDialogBase.CloseAll(connection);
|
||||||
connection.EndConnect();
|
connection.EndConnect();
|
||||||
MainWindowCommandInterface.SaveServerList();
|
MainWindowCommandInterface.SaveServerList();
|
||||||
MainWindowCommandInterface.RequestRefreshTreeView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AllActionsFinished(IXenConnection connection, bool treatCancelingAsFinished)
|
private bool AllActionsFinished(IXenConnection connection, bool treatCancelingAsFinished)
|
||||||
|
@ -817,7 +817,7 @@ namespace XenAdmin
|
|||||||
|
|
||||||
con.EndConnect();
|
con.EndConnect();
|
||||||
}
|
}
|
||||||
RequestRefreshTreeView();
|
|
||||||
//CA-41228 refresh submenu items when there are no connections
|
//CA-41228 refresh submenu items when there are no connections
|
||||||
SelectionManager.RefreshSelection();
|
SelectionManager.RefreshSelection();
|
||||||
}
|
}
|
||||||
@ -1158,74 +1158,27 @@ namespace XenAdmin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection_ConnectionResult(object sender, Network.ConnectionResultEventArgs e)
|
private void Connection_ConnectionResult(object sender, Network.ConnectionResultEventArgs e)
|
||||||
{
|
{
|
||||||
RequestRefreshTreeView();
|
RequestRefreshTreeView();
|
||||||
Program.Invoke(this, (EventHandler<ConnectionResultEventArgs>)Connection_ConnectionResult_, sender, e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Connection_ConnectionResult_(object sender, Network.ConnectionResultEventArgs e)
|
private void Connection_ConnectionClosed(object sender, EventArgs e)
|
||||||
{
|
|
||||||
Program.AssertOnEventThread();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateToolbars();
|
|
||||||
}
|
|
||||||
catch (Exception exn)
|
|
||||||
{
|
|
||||||
log.Error(exn, exn);
|
|
||||||
// Can do nothing more about this.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Connection_ConnectionClosed(object sender, EventArgs e)
|
|
||||||
{
|
{
|
||||||
RequestRefreshTreeView();
|
RequestRefreshTreeView();
|
||||||
Program.Invoke(this, (EventHandler<Network.ConnectionResultEventArgs>)Connection_ConnectionClosed_, sender, e);
|
|
||||||
gc();
|
gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Connection_ConnectionClosed_(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Program.AssertOnEventThread();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateToolbars();
|
|
||||||
}
|
|
||||||
catch (Exception exn)
|
|
||||||
{
|
|
||||||
log.Error(exn, exn);
|
|
||||||
// Nothing more we can do with this.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// called whenever our connection with the Xen server fails (i.e., after we've successfully logged in)
|
// called whenever our connection with the Xen server fails (i.e., after we've successfully logged in)
|
||||||
void Connection_ConnectionLost(object sender, EventArgs e)
|
private void Connection_ConnectionLost(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Program.Exiting)
|
if (Program.Exiting)
|
||||||
return;
|
return;
|
||||||
Program.Invoke(this, (EventHandler)Connection_ConnectionLost_, sender, e);
|
Program.Invoke(this, () => CloseActiveWizards((IXenConnection)sender));
|
||||||
RequestRefreshTreeView();
|
RequestRefreshTreeView();
|
||||||
gc();
|
gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Connection_ConnectionLost_(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Program.AssertOnEventThread();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
IXenConnection connection = (IXenConnection)sender;
|
|
||||||
CloseActiveWizards(connection);
|
|
||||||
|
|
||||||
UpdateToolbars();
|
|
||||||
}
|
|
||||||
catch (Exception exn)
|
|
||||||
{
|
|
||||||
log.Error(exn, exn);
|
|
||||||
// Can do nothing about this.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void gc()
|
private static void gc()
|
||||||
{
|
{
|
||||||
GC.Collect();
|
GC.Collect();
|
||||||
|
@ -449,7 +449,6 @@ namespace XenAdmin.Network
|
|||||||
//user cannot provide correct credentials, we d/c now to save the confusion of having the server available
|
//user cannot provide correct credentials, we d/c now to save the confusion of having the server available
|
||||||
//but unusable.
|
//but unusable.
|
||||||
EndConnect();
|
EndConnect();
|
||||||
OnConnectionClosed();
|
|
||||||
throw new CancelledException();
|
throw new CancelledException();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -781,7 +780,7 @@ namespace XenAdmin.Network
|
|||||||
}
|
}
|
||||||
|
|
||||||
_promptForNewPassword = null;
|
_promptForNewPassword = null;
|
||||||
OnConnectionStateChanged();
|
OnConnectionClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user