/// <summary> /// Executes the NewVMCommand /// </summary> private void ExecuteNewVMCommand() { if (CurrentVM != null) { if (messageBoxService.ShowYesNo("There is an active ViewModel, loose edits?", CustomDialogIcons.Question) == CustomDialogResults.Yes) { CurrentVM = new InMemoryViewModel(); } //Start out with PropertiesViewModel shown PropertiesViewModel propertiesViewModel = new PropertiesViewModel(); propertiesViewModel.IsCloseable = false; CurrentVM.PropertiesVM = propertiesViewModel; } else { CurrentVM = new InMemoryViewModel(); //Start out with PropertiesViewModel shown PropertiesViewModel propertiesViewModel = new PropertiesViewModel(); propertiesViewModel.IsCloseable = false; CurrentVM.PropertiesVM = propertiesViewModel; } }
/// <summary> /// If the compilationSucceeded is false, the user is asks if they would /// still like to generate the code anyway, and if they say yes the code /// is generated. If the compilationSucceeded is true, the code is simply /// generated. In either case this method returns true if the operation was /// successful. /// </summary> private static Boolean SaveGeneratedCode(Boolean compilationSucceeded, String compilationErrorMsg, String fileName, String code) { if (!compilationSucceeded) { if (MessageBoxService.ShowYesNo( "There was an issue with the code file\r\n" + compilationErrorMsg + "\r\n\r\n" + "But this could be due to a missing import required by one of the properties\r\n" + "Generate anyway?", CustomDialogIcons.Question) == CustomDialogResults.Yes) { using (TextWriter writer = new StreamWriter(fileName)) writer.Write(code); return(true); } else { return(false); } } else { using (TextWriter writer = new StreamWriter(fileName)) writer.Write(code); return(true); } }
/// <summary> /// Aplique le traitement du Volume. /// </summary> private void GererVolume() { if (defaultDevice.AudioEndpointVolume.Mute || defaultDevice.AudioEndpointVolume.MasterVolumeLevelScalar < 0.5) { if (messageService.ShowYesNo(AxLanguage.Languages.REAplan_Volume_Faible, CustomDialogIcons.Warning) == CustomDialogResults.Yes) { AugementerVolume(1F); } } }
/// <summary> /// Executes the ExitApplicationCommand /// </summary> private void ExecuteExitApplicationCommand() { ExitApplicationCommand.CommandSucceeded = false; if (messageBoxService.ShowYesNo( "Would you like to exit application", CustomDialogIcons.Question) == CustomDialogResults.Yes) { ExitApplicationCommand.CommandSucceeded = true; Application.Current.Shutdown(0); } }
private void ExecuteCloseViewCommand(Object arg) { var result = messageBoxService.ShowYesNo( "You are about to close this Option, you will loose any edits you have. Are you sure?", "Confirm close", CustomDialogIcons.Warning); if (result == CustomDialogResults.Yes) { IRegion region = regionManager.Regions["MainRegion"]; region.Remove(this); this.Dispose(); } }
/// <summary> /// Browse command executed. /// </summary> private void BrowseCommand_Executed() { IMessageBoxService messageBox = this.GlobalServiceProvider.Resolve <IMessageBoxService>(); IOpenFileService openFileService = this.GlobalServiceProvider.Resolve <IOpenFileService>(); openFileService.Filter = "Image files (png, jpeg, gif)|*.png;*.jpg;*.jpeg;*.gif"; if (openFileService.ShowDialog(null) == true) { // copy to images folder try { string targetImagesDirectory = this.referencePath + "\\" + ImageDirectory; // see if images directory exists if (!Directory.Exists(targetImagesDirectory)) { Directory.CreateDirectory(targetImagesDirectory); } // see if image is already in directory FileInfo info = new FileInfo(openFileService.FileName); if (info.DirectoryName == targetImagesDirectory) { // no need to do anything... } else { // see if file with the same name already exists if (File.Exists(targetImagesDirectory + "\\" + info.Name)) { if (messageBox.ShowYesNo("File " + info.Name + " already exists in " + targetImagesDirectory + ". Inserting the image would override the existing file. Do you want to continue?", CustomDialogIcons.Question) == CustomDialogResults.No) { return; } } } SourcePath = openFileService.FileName; RelativePath = "images/" + info.Name; this.IsInsertionValid = true; } catch (Exception ex) { messageBox.ShowError("Error while inserting image: " + ex.Message); } } }
private void DeconnexionAdmin() { if ((_msbs.ShowYesNo(AxLanguage.Languages.REAplan_Unconnect2, CustomDialogIcons.Question) == CustomDialogResults.Yes)) { try { Messenger.Default.Send(false, "DecoUtilisateur"); Singleton.logOff(); Messenger.Default.Send("n", "StopRobot");//stop le robot et reset l'ecran de jeu Messenger.Default.Send("", "ResetCurentListExercice"); _nav.NavigateTo <ConnexionTherapeuteViewModel>(true); } catch (Exception ex) { GestionErreur.GerrerErreur(ex); } } }
private void ImageWorkSpace_WorkspaceTabClosing(object sender, CancelEventArgs e) { e.Cancel = false; CustomDialogResults result = messageBoxService.ShowYesNo("Are you sure you want to close this tab?", CustomDialogIcons.Question); //if user did not want to cancel, keep workspace open if (result == CustomDialogResults.No) { e.Cancel = true; } //otherwise close workspace, and make sure to unhook WorkspaceTabClosing event //to prevent memory leak else { ((WorkspaceData)sender).WorkspaceTabClosing -= ImageWorkSpace_WorkspaceTabClosing; } }
/// <summary> /// Executes the DeleteOrderCommand /// </summary> private void ExecuteDeleteOrderCommand() { DeleteOrderCommand.CommandSucceeded = false; if (messageBoxService.ShowYesNo("Are you sure you want to remove this Order", CustomDialogIcons.Question) == CustomDialogResults.Yes) { try { if (DataAccess.DataService.DeleteOrder( CurrentCustomerOrder.OrderId.DataValue)) { CurrentCustomerOrder = null; LazyFetchOrdersForCustomer(); } } catch { messageBoxService.ShowError("There was a problem revoming the Order"); } } DeleteOrderCommand.CommandSucceeded = true; }