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
|
|
|
|
|
{
|
2015-07-29 09:44:41 +02:00
|
|
|
|
internal class HealthCheckCommand : Command
|
2015-05-18 16:28:37 +02:00
|
|
|
|
{
|
|
|
|
|
/// <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>
|
2015-07-29 09:44:41 +02:00
|
|
|
|
public HealthCheckCommand()
|
2015-05-18 16:28:37 +02:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-29 09:44:41 +02:00
|
|
|
|
public HealthCheckCommand(IMainWindow mainWindow)
|
2015-05-18 16:28:37 +02:00
|
|
|
|
: 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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|