protected override bool CanExecute(VM vm) { if (vm != null && !vm.is_a_template && !vm.Locked) { if (vm.power_state == vm_power_state.Running && HelpersGUI.HasRunningTasks(vm)) { return(true); } else { return(vm.allowed_operations != null && vm.allowed_operations.Contains(vm_operations.hard_reboot) && EnabledTargetExists(vm.Home(), vm.Connection)); } } return(false); }
protected override bool CanExecute(VM vm) { if (vm != null && !vm.Locked && !vm.is_a_template) { // CA-16960 If the VM is up and has a running task, we will disregard the allowed_operations // and always allow forced options. if (vm.power_state == vm_power_state.Running && HelpersGUI.HasRunningTasks(vm)) { return(true); } else { return(vm.allowed_operations != null && vm.allowed_operations.Contains(vm_operations.hard_shutdown)); } } return(false); }