protected override void ExecuteCore(SelectedItemCollection selection) { Command cmd = new RebootHostCommand(MainWindowCommandInterface, selection); if (cmd.CanExecute()) { cmd.Execute(); } else { cmd = new RebootVMCommand(MainWindowCommandInterface, selection); if (cmd.CanExecute()) { cmd.Execute(); } } }