2015-05-18 16:28:37 +02:00
|
|
|
|
using System.Linq;
|
2015-06-26 11:56:58 +02:00
|
|
|
|
using XenAdmin.Core;
|
|
|
|
|
using XenAPI;
|
2015-05-18 16:28:37 +02:00
|
|
|
|
|
|
|
|
|
namespace XenAdmin.Commands
|
|
|
|
|
{
|
|
|
|
|
internal class CallHomeCommand : Command
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of this Command. The parameter-less constructor is required if
|
|
|
|
|
/// this Command is to be attached to a ToolStrip menu item or button. It should not be used in any other scenario.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public CallHomeCommand()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CallHomeCommand(IMainWindow mainWindow)
|
|
|
|
|
: base(mainWindow)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void ExecuteCore(SelectedItemCollection selection)
|
|
|
|
|
{
|
2015-06-08 17:46:16 +02:00
|
|
|
|
if (Program.MainWindow.HealthCheckOverviewLauncher != null)
|
|
|
|
|
Program.MainWindow.HealthCheckOverviewLauncher.LaunchIfRequired(false, selection);
|
2015-05-18 16:28:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
|
|
|
|
{
|
2015-06-26 11:56:58 +02:00
|
|
|
|
return ConnectionsManager.XenConnectionsCopy.Any(xenConnection => xenConnection.IsConnected
|
|
|
|
|
&& !Helpers.FeatureForbidden(xenConnection, Host.RestrictHealthCheck));
|
2015-05-18 16:28:37 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|