private bool EnsureSaved() { if (AppState.Program == null || AppState.Program.IsModified == false) { return(true); } string fileName = "Untitled"; if (AppState.Program != null && !string.IsNullOrEmpty(AppState.Program.FileName)) { fileName = Path.GetFileName(AppState.Program.FileName); } SavePromptDialog dialog = new SavePromptDialog(); dialog.Message = string.Format("Do you want to save {0}?", fileName); dialog.Owner = this; SavePromptDialogResults result = dialog.ShowDialog(); if (result == SavePromptDialogResults.Cancel) { return(false); } if (result == SavePromptDialogResults.Save) { if (!Save(true)) { return(false); } return(true); } // Unknown result... // return(true); }
void OnBtnCancelClick(object sender, RoutedEventArgs e) { _result = SavePromptDialogResults.Cancel; Close(); }
void OnBtnContinueClick(object sender, RoutedEventArgs e) { _result = SavePromptDialogResults.Continue; Close(); }
private void btnCancel_Click(object sender, RoutedEventArgs e) { m_result = SavePromptDialogResults.Cancel; Close(); }