From 64e14bbc63a1b01ecbd6a1c7d7c25facfffad477 Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Tue, 8 Oct 2013 11:03:29 +0100 Subject: [PATCH] CP-6267: Stop jumping to the Events window when an action has started. Signed-off-by: Konstantina Chremmou --- XenAdmin/Commands/AddHostToPoolCommand.cs | 1 - XenAdmin/Commands/BackupHostCommand.cs | 3 --- .../Controls/MainWindowCommandInterface.cs | 6 ------ XenAdmin/Commands/ConvertVMToTemplateCommand.cs | 1 - XenAdmin/Commands/DeleteVMCommand.cs | 1 - XenAdmin/Commands/DestroyBondCommand.cs | 3 --- XenAdmin/Commands/ExportVMCommand.cs | 2 -- XenAdmin/Commands/HostMaintenanceModeCommand.cs | 1 - XenAdmin/Commands/InstallToolsCommand.cs | 6 ------ XenAdmin/Commands/PowerOnHostCommand.cs | 2 -- XenAdmin/Commands/RemoveHostCrashDumpsCommand.cs | 1 - XenAdmin/Commands/RestoreHostFromBackupCommand.cs | 2 -- XenAdmin/Commands/VMLifeCycleCommand.cs | 1 - XenAdmin/Commands/VMOperationCommand.cs | 2 -- XenAdmin/Commands/VMRecoveryModeCommand.cs | 1 - XenAdmin/Controls/NetworkingTab/NetworkList.cs | 2 -- XenAdmin/Dialogs/CustomFieldsDialog.cs | 2 -- XenAdmin/Dialogs/PropertiesDialog.cs | 1 - XenAdmin/MainWindow.cs | 14 -------------- XenAdmin/SettingsPanels/EditNetworkPage.cs | 1 - XenAdminTests/MainWindowWrapper/MockMainWindow.cs | 4 ---- 21 files changed, 57 deletions(-) diff --git a/XenAdmin/Commands/AddHostToPoolCommand.cs b/XenAdmin/Commands/AddHostToPoolCommand.cs index d203edcf7..1baa0efa4 100644 --- a/XenAdmin/Commands/AddHostToPoolCommand.cs +++ b/XenAdmin/Commands/AddHostToPoolCommand.cs @@ -143,7 +143,6 @@ namespace XenAdmin.Commands } MainWindowCommandInterface.SelectObjectInTree(_pool); - MainWindowCommandInterface.AllowHistorySwitch(); List actions = new List(); foreach (Host host in _hosts) diff --git a/XenAdmin/Commands/BackupHostCommand.cs b/XenAdmin/Commands/BackupHostCommand.cs index 5407b534d..a5fee2f22 100644 --- a/XenAdmin/Commands/BackupHostCommand.cs +++ b/XenAdmin/Commands/BackupHostCommand.cs @@ -86,10 +86,7 @@ namespace XenAdmin.Commands dialog.DefaultExt = "xbk"; if (dialog.ShowDialog(Parent) != DialogResult.Cancel) - { - MainWindowCommandInterface.AllowHistorySwitch(); new HostBackupRestoreAction(host, HostBackupRestoreAction.HostBackupRestoreType.backup, dialog.FileName).RunAsync(); - } } else { diff --git a/XenAdmin/Commands/Controls/MainWindowCommandInterface.cs b/XenAdmin/Commands/Controls/MainWindowCommandInterface.cs index b709fe353..99716ac25 100644 --- a/XenAdmin/Commands/Controls/MainWindowCommandInterface.cs +++ b/XenAdmin/Commands/Controls/MainWindowCommandInterface.cs @@ -53,7 +53,6 @@ namespace XenAdmin void TrySelectNewObjectInTree(Predicate tagMatch, bool selectNode, bool expandNode, bool ensureNodeVisible); void TrySelectNewObjectInTree(IXenConnection c, bool selectNode, bool expandNode, bool ensureNodeVisible); void Refresh(); - void AllowHistorySwitch(); void ShowPerXenModelObjectWizard(IXenObject obj, Form wizard); void ShowPerConnectionWizard(IXenConnection connection, Form wizard); void ShowForm(Type type); @@ -114,11 +113,6 @@ namespace XenAdmin _owner.RequestRefreshTreeView(); } - public void AllowHistorySwitch() - { - _owner.AllowHistorySwitch = true; - } - public void ShowPerXenModelObjectWizard(IXenObject obj, Form wizard) { _owner.ShowPerXenModelObjectWizard(obj, wizard); diff --git a/XenAdmin/Commands/ConvertVMToTemplateCommand.cs b/XenAdmin/Commands/ConvertVMToTemplateCommand.cs index 87d514163..7027fb12d 100644 --- a/XenAdmin/Commands/ConvertVMToTemplateCommand.cs +++ b/XenAdmin/Commands/ConvertVMToTemplateCommand.cs @@ -82,7 +82,6 @@ namespace XenAdmin.Commands actions.Add(new SetVMOtherConfigAction(vm.Connection, vm, "instant", "true")); actions.Add(new VMToTemplateAction(vm)); - MainWindowCommandInterface.AllowHistorySwitch(); MainWindowCommandInterface.CloseActiveWizards(vm); RunMultipleActions(actions, string.Format(Messages.ACTION_VM_TEMPLATIZING_TITLE, vm.Name), diff --git a/XenAdmin/Commands/DeleteVMCommand.cs b/XenAdmin/Commands/DeleteVMCommand.cs index 15ddf19e5..305555105 100644 --- a/XenAdmin/Commands/DeleteVMCommand.cs +++ b/XenAdmin/Commands/DeleteVMCommand.cs @@ -71,7 +71,6 @@ namespace XenAdmin.Commands private AsyncAction GetAction(VM vm, List deleteDisks, List deleteSnapshots) { - MainWindowCommandInterface.AllowHistorySwitch(); return new VMDestroyAction(vm, deleteDisks, deleteSnapshots); } diff --git a/XenAdmin/Commands/DestroyBondCommand.cs b/XenAdmin/Commands/DestroyBondCommand.cs index f5ed9de15..5fd7b08e5 100644 --- a/XenAdmin/Commands/DestroyBondCommand.cs +++ b/XenAdmin/Commands/DestroyBondCommand.cs @@ -147,10 +147,7 @@ namespace XenAdmin.Commands // done the right thing and that the bond hasn't been deleted in the meantime. (CA-27436). Bond bond = pif.BondMasterOf; if (bond != null) - { - Program.MainWindow.AllowHistorySwitch = true; new Actions.DestroyBondAction(bond, new_name).RunAsync(); - } } } } diff --git a/XenAdmin/Commands/ExportVMCommand.cs b/XenAdmin/Commands/ExportVMCommand.cs index c349b2078..64c1c412f 100644 --- a/XenAdmin/Commands/ExportVMCommand.cs +++ b/XenAdmin/Commands/ExportVMCommand.cs @@ -180,8 +180,6 @@ namespace XenAdmin.Commands Directory.SetCurrentDirectory(oldDir); } - MainWindowCommandInterface.AllowHistorySwitch(); - new ExportVmAction(connection, host, vm, filename, verify).RunAsync(); } diff --git a/XenAdmin/Commands/HostMaintenanceModeCommand.cs b/XenAdmin/Commands/HostMaintenanceModeCommand.cs index aaf1a59b1..353c17175 100644 --- a/XenAdmin/Commands/HostMaintenanceModeCommand.cs +++ b/XenAdmin/Commands/HostMaintenanceModeCommand.cs @@ -126,7 +126,6 @@ namespace XenAdmin.Commands } } - MainWindowCommandInterface.AllowHistorySwitch(); MainWindowCommandInterface.CloseActiveWizards(host.Connection); var action = new EnableHostAction(host, result == DialogResult.Yes,AddHostToPoolCommand.EnableNtolDialog); action.Completed += delegate { MainWindowCommandInterface.Refresh(); }; diff --git a/XenAdmin/Commands/InstallToolsCommand.cs b/XenAdmin/Commands/InstallToolsCommand.cs index 27934666e..364b0e25e 100644 --- a/XenAdmin/Commands/InstallToolsCommand.cs +++ b/XenAdmin/Commands/InstallToolsCommand.cs @@ -127,7 +127,6 @@ namespace XenAdmin.Commands ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo).ShowDialog(Parent) == DialogResult.Yes) { - MainWindowCommandInterface.AllowHistorySwitch(); CreateCdDriveAction createDriveAction = new CreateCdDriveAction(vm, true,NewDiskDialog.ShowMustRebootBoxCD,NewDiskDialog.ShowVBDWarningBox); new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(Parent); @@ -143,7 +142,6 @@ namespace XenAdmin.Commands DialogResult dr = new InstallToolsWarningDialog(vm.Connection).ShowDialog(Parent); if (dr == DialogResult.Yes) { - MainWindowCommandInterface.AllowHistorySwitch(); InstallPVToolsAction installToolsAction = new InstallPVToolsAction( vm, XSToolsSRNotFound, Properties.Settings.Default.ShowHiddenVMs); installToolsAction.Completed += InstallToolsActionCompleted; @@ -186,8 +184,6 @@ namespace XenAdmin.Commands ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo).ShowDialog(Parent) == DialogResult.Yes) { - MainWindowCommandInterface.AllowHistorySwitch(); - foreach (VM vm in vms) { if (CanExecute(vm) && vm.FindVMCDROM() == null) @@ -208,8 +204,6 @@ namespace XenAdmin.Commands if (new InstallToolsWarningDialog(null, true, vmConnections).ShowDialog(Parent) == DialogResult.Yes) { - MainWindowCommandInterface.AllowHistorySwitch(); - foreach (VM vm in vms) { InstallPVToolsAction installToolsAction = new InstallPVToolsAction(vm, XSToolsSRNotFound, Properties.Settings.Default.ShowHiddenVMs); diff --git a/XenAdmin/Commands/PowerOnHostCommand.cs b/XenAdmin/Commands/PowerOnHostCommand.cs index c3e3988e6..36bc90dc3 100644 --- a/XenAdmin/Commands/PowerOnHostCommand.cs +++ b/XenAdmin/Commands/PowerOnHostCommand.cs @@ -91,8 +91,6 @@ namespace XenAdmin.Commands protected override void ExecuteCore(SelectedItemCollection selection) { - MainWindowCommandInterface.AllowHistorySwitch(); - List actions = new List(); foreach (Host host in selection.AsXenObjects(CanExecute)) { diff --git a/XenAdmin/Commands/RemoveHostCrashDumpsCommand.cs b/XenAdmin/Commands/RemoveHostCrashDumpsCommand.cs index cc5298b94..8aba687b6 100644 --- a/XenAdmin/Commands/RemoveHostCrashDumpsCommand.cs +++ b/XenAdmin/Commands/RemoveHostCrashDumpsCommand.cs @@ -72,7 +72,6 @@ namespace XenAdmin.Commands if (result == DialogResult.OK) { - MainWindowCommandInterface.AllowHistorySwitch(); new DestroyHostCrashDumpAction(host).RunAsync(); } } diff --git a/XenAdmin/Commands/RestoreHostFromBackupCommand.cs b/XenAdmin/Commands/RestoreHostFromBackupCommand.cs index e9e077a77..5bc27afc0 100644 --- a/XenAdmin/Commands/RestoreHostFromBackupCommand.cs +++ b/XenAdmin/Commands/RestoreHostFromBackupCommand.cs @@ -127,7 +127,6 @@ namespace XenAdmin.Commands if (hostdialog.DialogResult != DialogResult.OK) return; host = hostdialog.TheHost; - MainWindowCommandInterface.AllowHistorySwitch(); HostBackupRestoreAction action = new HostBackupRestoreAction(host, HostBackupRestoreAction.HostBackupRestoreType.restore, filepath); action.Completed += RestoreAction_Completed; action.RunAsync(); @@ -136,7 +135,6 @@ namespace XenAdmin.Commands } else { - MainWindowCommandInterface.AllowHistorySwitch(); HostBackupRestoreAction action = new HostBackupRestoreAction(host, HostBackupRestoreAction.HostBackupRestoreType.restore, filepath); action.Completed += RestoreAction_Completed; action.RunAsync(); diff --git a/XenAdmin/Commands/VMLifeCycleCommand.cs b/XenAdmin/Commands/VMLifeCycleCommand.cs index a7d75b101..a2085c71f 100644 --- a/XenAdmin/Commands/VMLifeCycleCommand.cs +++ b/XenAdmin/Commands/VMLifeCycleCommand.cs @@ -90,7 +90,6 @@ namespace XenAdmin.Commands protected void RunAction(IEnumerable vms, string title, string startDescription, string endDescription, Dictionary> vbdsToEjectDict) { - MainWindowCommandInterface.AllowHistorySwitch(); var actions = GetActions(vms, title, startDescription, endDescription, vbdsToEjectDict); RunMultipleActions(actions, title, startDescription, endDescription, true); } diff --git a/XenAdmin/Commands/VMOperationCommand.cs b/XenAdmin/Commands/VMOperationCommand.cs index 5d453f047..1f30acc50 100644 --- a/XenAdmin/Commands/VMOperationCommand.cs +++ b/XenAdmin/Commands/VMOperationCommand.cs @@ -115,10 +115,8 @@ namespace XenAdmin.Commands protected override void ExecuteCore(SelectedItemCollection selection) { - AssertOperationAllowsExecution(); - Program.MainWindow.AllowHistorySwitch = true; string title = Messages.ACTION_VMS_RESUMING_ON_TITLE; string startDescription = Messages.ACTION_VM_RESUMING; string endDescription = Messages.ACTION_VM_RESUMED; diff --git a/XenAdmin/Commands/VMRecoveryModeCommand.cs b/XenAdmin/Commands/VMRecoveryModeCommand.cs index abde0112a..eeb23d2c2 100644 --- a/XenAdmin/Commands/VMRecoveryModeCommand.cs +++ b/XenAdmin/Commands/VMRecoveryModeCommand.cs @@ -69,7 +69,6 @@ namespace XenAdmin.Commands protected override void ExecuteCore(SelectedItemCollection selection) { - MainWindowCommandInterface.AllowHistorySwitch(); new HVMBootAction((VM)selection[0].XenObject).RunAsync(); } diff --git a/XenAdmin/Controls/NetworkingTab/NetworkList.cs b/XenAdmin/Controls/NetworkingTab/NetworkList.cs index d4363da86..ed9170fe2 100644 --- a/XenAdmin/Controls/NetworkingTab/NetworkList.cs +++ b/XenAdmin/Controls/NetworkingTab/NetworkList.cs @@ -605,8 +605,6 @@ namespace XenAdmin.Controls.NetworkingTab private void DoRemoveNetwork() { - Program.MainWindow.AllowHistorySwitch = true; - if (SelectedVif != null) { VM vm = XenObject as VM; diff --git a/XenAdmin/Dialogs/CustomFieldsDialog.cs b/XenAdmin/Dialogs/CustomFieldsDialog.cs index 28956fb9f..297c4c6a2 100644 --- a/XenAdmin/Dialogs/CustomFieldsDialog.cs +++ b/XenAdmin/Dialogs/CustomFieldsDialog.cs @@ -105,8 +105,6 @@ namespace XenAdmin.Dialogs if (!MainWindow.Confirm(connection, Program.MainWindow, Messages.MESSAGEBOX_CONFIRM, Messages.MESSAGEBOX_DELETE_CUSTOM_FIELD, name)) return; - Program.MainWindow.AllowHistorySwitch = true; - int selIdx = lbCustomFields.SelectedIndex; lbCustomFields.Items.RemoveAt(selIdx); diff --git a/XenAdmin/Dialogs/PropertiesDialog.cs b/XenAdmin/Dialogs/PropertiesDialog.cs index 1b6ca4394..3e61e0df3 100644 --- a/XenAdmin/Dialogs/PropertiesDialog.cs +++ b/XenAdmin/Dialogs/PropertiesDialog.cs @@ -320,7 +320,6 @@ namespace XenAdmin.Dialogs // Yes, save to the LocalXenObject. List actions = SaveSettings(); - Program.MainWindow.AllowHistorySwitch = true; Program.Invoke(Program.MainWindow.GeneralPage, Program.MainWindow.GeneralPage.EnableDisableEdit); // Add a save changes on the beginning of the actions to enact the alterations that were just changes to the xenObjectCopy. diff --git a/XenAdmin/MainWindow.cs b/XenAdmin/MainWindow.cs index c63802136..e1a6f07ab 100644 --- a/XenAdmin/MainWindow.cs +++ b/XenAdmin/MainWindow.cs @@ -100,14 +100,6 @@ namespace XenAdmin internal readonly AdPage AdPage = new AdPage(); private bool IgnoreTabChanges = false; - public bool AllowHistorySwitch - { - set - { - if (value) - navigationPane.SwitchToNotificationsView(NotificationsSubMode.Events); - } - } private bool ToolbarsEnabled; private readonly Dictionary> activePoolWizards = new Dictionary>(); @@ -796,7 +788,6 @@ namespace XenAdmin { Program.MainWindow.closeActiveWizards(host); - AllowHistorySwitch = true; var action = new DisableHostAction(host); action.Completed += action_Completed; action.RunAsync(); @@ -1559,7 +1550,6 @@ namespace XenAdmin private void DoLicenseAction(Host host, string filePath) { - AllowHistorySwitch = true; ApplyLicenseAction action = new ApplyLicenseAction(host.Connection, host, filePath); ActionProgressDialog actionProgress = new ActionProgressDialog(action, ProgressBarStyle.Marquee); @@ -1580,7 +1570,6 @@ namespace XenAdmin /// private void TheTabControl_SelectedIndexChanged(object sender, EventArgs e) { - AllowHistorySwitch = false; if (IgnoreTabChanges) return; @@ -2531,7 +2520,6 @@ namespace XenAdmin private void navigationPane_TreeNodeBeforeSelected() { SearchMode = false; - AllowHistorySwitch = false; } private void navigationPane_TreeNodeClicked() @@ -2701,8 +2689,6 @@ namespace XenAdmin return false; } - Program.MainWindow.AllowHistorySwitch = true; - return true; } diff --git a/XenAdmin/SettingsPanels/EditNetworkPage.cs b/XenAdmin/SettingsPanels/EditNetworkPage.cs index c2267a46b..7ab639ae9 100644 --- a/XenAdmin/SettingsPanels/EditNetworkPage.cs +++ b/XenAdmin/SettingsPanels/EditNetworkPage.cs @@ -643,7 +643,6 @@ namespace XenAdmin.SettingsPanels a.Host = h; break; } - Program.MainWindow.AllowHistorySwitch = true; actions.Add(a); } diff --git a/XenAdminTests/MainWindowWrapper/MockMainWindow.cs b/XenAdminTests/MainWindowWrapper/MockMainWindow.cs index 984f59497..c2695c723 100644 --- a/XenAdminTests/MainWindowWrapper/MockMainWindow.cs +++ b/XenAdminTests/MainWindowWrapper/MockMainWindow.cs @@ -65,10 +65,6 @@ namespace XenAdminTests { } - public void AllowHistorySwitch() - { - } - public void ShowPerXenModelObjectWizard(IXenObject obj, Form wizard) {