It was not possible to load a xapi database from the CLI.

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
Konstantina Chremmou 2023-05-09 15:12:04 +01:00
parent 801125f448
commit bffe739b86
3 changed files with 10 additions and 19 deletions

View File

@ -82,10 +82,11 @@ namespace XenAdmin.Core
/// <param name="f">The form to be brought to the front.</param>
public static void BringFormToFront(Form f)
{
if (f == null)
return;
if (f.WindowState == FormWindowState.Minimized)
{
f.WindowState = FormWindowState.Normal;
}
f.BringToFront();
f.Activate();

View File

@ -172,7 +172,7 @@ namespace XenAdmin.Dialogs
{
conn.Hostname = server;
conn.Port = ConnectionsManager.DEFAULT_XEN_PORT;
XenConnectionUI.ConnectToXapiDatabase(conn, this);
XenConnectionUI.ConnectToXapiDatabase(conn, Owner);
}
else if (!_changedPass)
{

View File

@ -35,6 +35,7 @@ using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Text;
@ -116,7 +117,6 @@ namespace XenAdmin
private readonly Dictionary<IXenConnection, IList<Form>> activePoolWizards = new Dictionary<IXenConnection, IList<Form>>();
private string[] _commandLineArgs;
private bool _launched;
private static readonly System.Windows.Forms.Timer CheckForUpdatesTimer = new System.Windows.Forms.Timer();
@ -729,13 +729,10 @@ namespace XenAdmin
Password = args.Length > 3 ? args[3] : ""
};
if (ConnectionsManager.XenConnectionsContains(connection))
break;
lock (ConnectionsManager.ConnectionsLock)
ConnectionsManager.XenConnections.Add(connection);
XenConnectionUI.BeginConnect(connection, true, null, false);
if (File.Exists(args[1]))
XenConnectionUI.ConnectToXapiDatabase(connection, this);
else
XenConnectionUI.BeginConnect(connection, true, this, false);
break;
default:
log.Warn("CLI: Wrong syntax or unknown command line options.");
@ -743,14 +740,7 @@ namespace XenAdmin
}
}
if (_launched)
{
// if already running, draw the user's attention
HelpersGUI.BringFormToFront(this);
Activate();
}
_launched = true;
HelpersGUI.BringFormToFront(this);
}
#endregion