mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-22 00:00:40 +01:00
Register events for connection only if a connection dialog does not exist already.
If they are registered on all cases and then unregistered and a new connection is attempted, the connection dialog launched from the first connection attempt is not closed after connection is established, because the connection events have been unregistered. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
7925bcae27
commit
711d1d0e63
@ -58,19 +58,19 @@ namespace XenAdmin.Network
|
|||||||
public static void BeginConnect(IXenConnection connection, bool interactive, Form owner, bool initiateMasterSearch)
|
public static void BeginConnect(IXenConnection connection, bool interactive, Form owner, bool initiateMasterSearch)
|
||||||
{
|
{
|
||||||
Program.AssertOnEventThread();
|
Program.AssertOnEventThread();
|
||||||
RegisterEventHandlers(connection);
|
|
||||||
if (interactive)
|
if (interactive)
|
||||||
{
|
{
|
||||||
// CA-214953 - Focus on this connection's dialog, if one exists, otherwise create one
|
// CA-214953 - Focus on this connection's dialog, if one exists, otherwise create one
|
||||||
if (connectionDialogs.TryGetValue(connection, out ConnectingToServerDialog dlg))
|
if (connectionDialogs.TryGetValue(connection, out ConnectingToServerDialog dlg))
|
||||||
{
|
{
|
||||||
UnregisterEventHandlers(connection);
|
|
||||||
if (dlg.WindowState == FormWindowState.Minimized)
|
if (dlg.WindowState == FormWindowState.Minimized)
|
||||||
dlg.WindowState = FormWindowState.Normal;
|
dlg.WindowState = FormWindowState.Normal;
|
||||||
dlg.Focus();
|
dlg.Focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegisterEventHandlers(connection);
|
||||||
dlg = new ConnectingToServerDialog(connection);
|
dlg = new ConnectingToServerDialog(connection);
|
||||||
connectionDialogs.Add(connection, dlg);
|
connectionDialogs.Add(connection, dlg);
|
||||||
|
|
||||||
@ -78,7 +78,10 @@ namespace XenAdmin.Network
|
|||||||
connectionDialogs.Remove(connection);
|
connectionDialogs.Remove(connection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
RegisterEventHandlers(connection);
|
||||||
((XenConnection)connection).BeginConnect(initiateMasterSearch, PromptForNewPassword);
|
((XenConnection)connection).BeginConnect(initiateMasterSearch, PromptForNewPassword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool PromptForNewPassword(IXenConnection connection, string oldPassword)
|
private static bool PromptForNewPassword(IXenConnection connection, string oldPassword)
|
||||||
|
Loading…
Reference in New Issue
Block a user