/// <summary> /// Attempts to install tools on several VMs /// </summary> /// <param name="vms"></param> /// <returns>Whether the action was launched (i.e., the user didn't Cancel)</returns> private bool MultipleVMExecute(List <VM> vms) { bool newDvdDrivesRequired = false; foreach (VM vm in vms) { if (CanExecute(vm) && vm.FindVMCDROM() == null) { newDvdDrivesRequired = true; break; } } if (newDvdDrivesRequired) { if (new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, Messages.NEW_DVD_DRIVES_REQUIRED, Messages.XENCENTER), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo).ShowDialog(Parent) == DialogResult.Yes) { foreach (VM vm in vms) { if (CanExecute(vm) && vm.FindVMCDROM() == null) { CreateCdDriveAction createDriveAction = new CreateCdDriveAction(vm, true, NewDiskDialog.ShowMustRebootBoxCD, NewDiskDialog.ShowVBDWarningBox); new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(Parent); } } ShowMustRebootBox(); return(true); } } else { List <IXenConnection> vmConnections = new List <IXenConnection>(); foreach (VM vm in vms) { vmConnections.Add(vm.Connection); } if (new InstallToolsWarningDialog(null, true, vmConnections).ShowDialog(Parent) == DialogResult.Yes) { foreach (VM vm in vms) { InstallPVToolsAction installToolsAction = new InstallPVToolsAction(vm, XSToolsSRNotFound, Properties.Settings.Default.ShowHiddenVMs); if (vms.IndexOf(vm) == 0) { installToolsAction.Completed += FirstInstallToolsActionCompleted; } else { installToolsAction.Completed += InstallToolsActionCompleted; } installToolsAction.RunAsync(); } return(true); } } return(false); }
private void newCDLabel_Click(object sender, EventArgs e) { if (VM != null) { CreateCdDriveAction createDriveAction = new CreateCdDriveAction(VM, false, NewDiskDialog.ShowMustRebootBoxCD, NewDiskDialog.ShowVBDWarningBox); new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(this); } }
private void newCDLabel_Click(object sender, EventArgs e) { if (VM != null) { var createDriveAction = new CreateCdDriveAction(VM); createDriveAction.ShowUserInstruction += CreateDriveAction_ShowUserInstruction; using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee)) dlg.ShowDialog(this); } }
/// <summary> /// Attempts to install tools on the vm /// </summary> /// <param name="vm"></param> /// <returns>null if user cancels or an AsyncAction. This is either the InstallPVToolsAction or the CreateCdDriveAction if the VM needed a DVD drive.</returns> private void SingleVMExecute(VM vm) { if (vm.FindVMCDROM() == null) { DialogResult dialogResult; using (var dlg = new NoIconDialog(Messages.NEW_DVD_DRIVE_REQUIRED, ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)) { dialogResult = dlg.ShowDialog(Parent); } if (dialogResult == DialogResult.Yes) { //do not register the event ShowUserInstruction; we show explicitly a message afterwards var createDriveAction = new CreateCdDriveAction(vm); using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee)) dlg.ShowDialog(Parent); if (createDriveAction.Succeeded) { ShowMustRebootBox(); } InstallTools?.Invoke(createDriveAction); } return; } using (var dlg = new WarningDialog(Messages.XS_TOOLS_MESSAGE_ONE_VM, new ThreeButtonDialog.TBDButton(Messages.INSTALL_XENSERVER_TOOLS_BUTTON, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT, true), ThreeButtonDialog.ButtonCancel) { ShowLinkLabel = true, LinkText = Messages.INSTALLTOOLS_READ_MORE, LinkAction = () => Help.HelpManager.Launch("InstallToolsWarningDialog") }) if (dlg.ShowDialog(Parent) == DialogResult.OK && CheckToolSrs(vm)) { var installToolsAction = new InstallPVToolsAction(vm, Properties.Settings.Default.ShowHiddenVMs); installToolsAction.Completed += InstallToolsActionCompleted; installToolsAction.RunAsync(); InstallTools?.Invoke(installToolsAction); } }
/// <summary> /// Attempts to install tools on the vm /// </summary> /// <param name="vm"></param> /// <returns>null if user cancels or an AsyncAction. This is either the InstallPVToolsAction or the CreateCdDriveAction if the VM needed a DVD drive.</returns> private AsyncAction SingleVMExecute(VM vm) { if (vm.FindVMCDROM() == null) { DialogResult dialogResult; using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details( null, Messages.NEW_DVD_DRIVE_REQUIRED, Messages.XENCENTER), ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)) { dialogResult = dlg.ShowDialog(Parent); } if (dialogResult == DialogResult.Yes) { //do not register the event ShowUserInstruction; we show explicitly a message afterwards var createDriveAction = new CreateCdDriveAction(vm); using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee)) { dlg.ShowDialog(Parent); } if (createDriveAction.Succeeded) { ShowMustRebootBox(); } return(createDriveAction); } } else { DialogResult dr = new InstallToolsWarningDialog(vm.Connection).ShowDialog(Parent); if (dr == DialogResult.Yes) { var installToolsAction = new InstallPVToolsAction(vm, Properties.Settings.Default.ShowHiddenVMs); installToolsAction.Completed += InstallToolsActionCompleted; installToolsAction.RunAsync(); return(installToolsAction); } } return(null); }
private void newCDLabel_Click(object sender, EventArgs e) { if (VM != null) { CreateCdDriveAction createDriveAction = new CreateCdDriveAction(VM, false, NewDiskDialog.ShowMustRebootBoxCD, NewDiskDialog.ShowVBDWarningBox); new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee).ShowDialog(this); if (createDriveAction.Succeeded) { if (!Program.RunInAutomatedTestMode) { new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Information, Messages.NEW_DVD_DRIVE_REBOOT, Messages.NEW_DVD_DRIVE_CREATED)).ShowDialog(Program.MainWindow); } } } }
/// <summary> /// Attempts to install tools on the vm /// </summary> /// <param name="vm"></param> /// <returns>null if user cancels or an AsyncAction. This is either the InstallPVToolsAction or the CreateCdDriveAction if the VM needed a DVD drive.</returns> private AsyncAction SingleVMExecute(VM vm) { if (vm.FindVMCDROM() == null) { if (new ThreeButtonDialog( new ThreeButtonDialog.Details( null, Messages.NEW_DVD_DRIVE_REQUIRED, Messages.XENCENTER), 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); if (createDriveAction.Succeeded) { ShowMustRebootBox(); } return(createDriveAction); } } else { 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; installToolsAction.RunAsync(); return(installToolsAction); } } return(null); }
/// <summary> /// Attempts to install tools on several VMs /// </summary> /// <param name="vms"></param> /// <returns>Whether the action was launched (i.e., the user didn't Cancel)</returns> private void MultipleVMExecute(List <VM> vms) { bool newDvdDrivesRequired = false; foreach (VM vm in vms) { if (CanExecute(vm) && vm.FindVMCDROM() == null) { newDvdDrivesRequired = true; break; } } if (newDvdDrivesRequired) { DialogResult dialogResult; using (var dlg = new WarningDialog(Messages.NEW_DVD_DRIVES_REQUIRED, ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)) { dialogResult = dlg.ShowDialog(Parent); } if (dialogResult == DialogResult.Yes) { foreach (VM vm in vms) { if (CanExecute(vm) && vm.FindVMCDROM() == null) { //do not register the event ShowUserInstruction; we show explicitly a message afterwards var createDriveAction = new CreateCdDriveAction(vm); using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee)) { dlg.ShowDialog(Parent); } } } ShowMustRebootBox(); InstallTools?.Invoke(null); } } else { using (var dlg = new WarningDialog(Messages.XS_TOOLS_MESSAGE_MORE_THAN_ONE_VM, new ThreeButtonDialog.TBDButton(Messages.INSTALL_XENSERVER_TOOLS_BUTTON, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT, true), ThreeButtonDialog.ButtonCancel) { ShowLinkLabel = true, LinkText = Messages.INSTALLTOOLS_READ_MORE, LinkAction = () => Help.HelpManager.Launch("InstallToolsWarningDialog") }) if (dlg.ShowDialog(Parent) == DialogResult.OK && CheckToolSrs(vms.ToArray())) { foreach (VM vm in vms) { var installToolsAction = new InstallPVToolsAction(vm, Properties.Settings.Default.ShowHiddenVMs); if (vms.IndexOf(vm) == 0) { installToolsAction.Completed += FirstInstallToolsActionCompleted; } else { installToolsAction.Completed += InstallToolsActionCompleted; } installToolsAction.RunAsync(); } InstallTools?.Invoke(null); } } }
/// <summary> /// Attempts to install tools on several VMs /// </summary> /// <param name="vms"></param> /// <returns>Whether the action was launched (i.e., the user didn't Cancel)</returns> private bool MultipleVMExecute(List <VM> vms) { bool newDvdDrivesRequired = false; foreach (VM vm in vms) { if (CanExecute(vm) && vm.FindVMCDROM() == null) { newDvdDrivesRequired = true; break; } } if (newDvdDrivesRequired) { DialogResult dialogResult; using (var dlg = new WarningDialog(Messages.NEW_DVD_DRIVES_REQUIRED, ThreeButtonDialog.ButtonYes, ThreeButtonDialog.ButtonNo)) { dialogResult = dlg.ShowDialog(Parent); } if (dialogResult == DialogResult.Yes) { foreach (VM vm in vms) { if (CanExecute(vm) && vm.FindVMCDROM() == null) { //do not register the event ShowUserInstruction; we show explicitly a message afterwards var createDriveAction = new CreateCdDriveAction(vm); using (var dlg = new ActionProgressDialog(createDriveAction, ProgressBarStyle.Marquee)) { dlg.ShowDialog(Parent); } } } ShowMustRebootBox(); return(true); } } else { List <IXenConnection> vmConnections = new List <IXenConnection>(); foreach (VM vm in vms) { vmConnections.Add(vm.Connection); } if (new InstallToolsWarningDialog(null, true, vmConnections).ShowDialog(Parent) == DialogResult.Yes) { foreach (VM vm in vms) { var installToolsAction = new InstallPVToolsAction(vm, Properties.Settings.Default.ShowHiddenVMs); if (vms.IndexOf(vm) == 0) { installToolsAction.Completed += FirstInstallToolsActionCompleted; } else { installToolsAction.Completed += InstallToolsActionCompleted; } installToolsAction.RunAsync(); } return(true); } } return(false); }