/// <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); }
/// <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); }