예제 #1
0
 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     // Can execute criteria: A selection of VMs in the same pool which has CBT feature licensed, where at least one VM having CBT enabled
     return(selection.AllItemsAre <VM>(CbtLicensed) &&
            selection.GetConnectionOfAllItems() != null &&
            selection.AtLeastOneXenObjectCan <VM>(CanExecute));
 }
예제 #2
0
 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     if (selection.AllItemsAre <DockerContainer>())
     {
         return(selection.AtLeastOneXenObjectCan <DockerContainer>(CanExecute));
     }
     return(false);
 }
예제 #3
0
 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     if (selection.AllItemsAre <VM>() && new CrossPoolMoveVMCommand(MainWindowCommandInterface, selection).CanExecute())
     {
         return(true);
     }
     return(selection.ContainsOneItemOfType <VM>() && selection.AtLeastOneXenObjectCan <VM>(CanExecute));
 }
예제 #4
0
        protected override bool CanExecuteCore(SelectedItemCollection selection)
        {
            Host hostAncestor = selection.HostAncestorFromConnection;
            Pool poolAncestor = selection.PooAncestorFromConnection;

            if ((poolAncestor != null || hostAncestor != null) && //CA-61207: this check ensures there's no cross-pool selection
                (selection.FirstIs <Pool>() || selection.FirstIs <Host>() || selection.FirstIsRealVM || selection.FirstIs <VM_appliance>()))
            {
                if (selection.AllItemsAre <VM>())
                {
                    return(selection.AtLeastOneXenObjectCan <VM>(CanExportVm));
                }

                if (selection.AllItemsAre <VM_appliance>())
                {
                    if (selection.Count != 1)
                    {
                        return(false);
                    }

                    var appliance = ((VM_appliance)selection.FirstAsXenObject);
                    return(appliance.VMs.TrueForAll(vmRef =>
                    {
                        var vm = appliance.Connection.Resolve(vmRef);
                        return vm != null &&
                        CanExportVm(vm);
                    }));
                }

                if ((hostAncestor != null && hostAncestor.enabled && hostAncestor.IsLive && selection[0].Connection.IsConnected) ||
                    (poolAncestor != null && Helpers.PoolHasEnabledHosts(poolAncestor)))
                {
                    var vms = selection.FirstAsXenObject.Connection.Cache.VMs.Where(vm => vm.is_a_real_vm && CanExportVm(vm) && vm.Show(Properties.Settings.Default.ShowHiddenVMs)).ToList();
                    if (vms.Count > 0)
                    {
                        return(vms.Any(CanExportVm));
                    }
                }
            }

            return(false);
        }
예제 #5
0
        protected override bool CanExecuteCore(SelectedItemCollection selection)
        {
            if (selection.AllItemsAre <VM_appliance>())
            {
                return(selection.AtLeastOneXenObjectCan <VM_appliance>(CanShutDownAppliance));
            }

            if (selection.AllItemsAre <VM>())
            {
                var firstVm = (VM)selection.First;
                if (firstVm.IsAssignedToVapp)
                {
                    var firstVapp = firstVm.appliance;
                    if (selection.AsXenObjects <VM>().All(vm => vm.appliance != null && vm.appliance.opaque_ref == firstVapp.opaque_ref))
                    {
                        return(CanShutDownAppliance(firstVm.Connection.Resolve(firstVapp)));
                    }
                }
            }

            return(false);
        }
예제 #6
0
 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     return(selection.ContainsOneItemOfType <Host>() && selection.AtLeastOneXenObjectCan <Host>(CanExecute));
 }
예제 #7
0
 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     return(selection.AllItemsAre <Host>() && selection.AtLeastOneXenObjectCan <Host>(CanExecute));
 }
예제 #8
0
 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     return(selection.ContainsOneItemOfType <VM>() && selection.AtLeastOneXenObjectCan <VM>(v => v.is_a_snapshot));
 }
예제 #9
0
 protected override bool CanExecuteCore(SelectedItemCollection selection)
 {
     return(selection.AllItemsAre <VM>() && selection.AtLeastOneXenObjectCan <VM>(CanExecute) &&
            (selection.PoolAncestor != null || selection.HostAncestor != null)); //CA-61207: this check ensures there's no cross-pool selection
 }