protected override void ExecuteCore(SelectedItemCollection selection) { VM template = (VM)selection[0].XenObject; if (CrossPoolCopyTemplateCommand.CanExecute(template, null)) { new CrossPoolCopyTemplateCommand(MainWindowCommandInterface, selection).Execute(); } else { MainWindowCommandInterface.ShowPerXenModelObjectWizard(template, new CopyVMDialog(template)); } }
protected override void ExecuteCore(SelectedItemCollection selection) { VM template = (VM)selection[0].XenObject; if (CrossPoolCopyTemplateCommand.CanExecute(template, null, false)) { new CrossPoolCopyTemplateCommand(MainWindowCommandInterface, selection).Execute(); } else { new CopyVMDialog(template).ShowPerXenObject(template, Program.MainWindow); } }
private static bool CanExecute(VM vm) { if (vm != null && vm.is_a_template && !vm.is_a_snapshot && !vm.Locked && vm.allowed_operations != null && !vm.InternalTemplate) { if (CrossPoolCopyTemplateCommand.CanExecute(vm, null)) { return(true); } if (vm.allowed_operations.Contains(vm_operations.clone) || vm.allowed_operations.Contains(vm_operations.copy)) { return(true); } } return(false); }