private void SetsView_OnSetClosing(object sender, SetClosingEventArgs e) { if (!(e.Set.Content is ITextEditor textEditor)) return; if (TextEditorClosing != null) { e.Cancel = true; TextEditorClosing.Invoke(this, textEditor); } }
private void SetsView_OnSetClosing(object sender, SetClosingEventArgs e) { if (!(e.Set.Content is TextEditor textEditor)) { return; } if (textEditor.Saved) { return; } if (OnTextEditorClosingWithUnsavedContent != null) { e.Cancel = true; OnTextEditorClosingWithUnsavedContent.Invoke(this, textEditor); } }
private void SetsView_OnSetClosing(object sender, SetClosingEventArgs e) { //LoggingService.LogInfo("Closing a text editor."); if (!(e.Set.Content is TextEditor textEditor)) { return; } if (!textEditor.IsModified) { return; } if (TextEditorClosingWithUnsavedContent != null) { e.Cancel = true; TextEditorClosingWithUnsavedContent.Invoke(this, textEditor); } }
private async void SetsView_OnSetClosing(object sender, SetClosingEventArgs e) { if (!(e.Set.Content is TextEditor textEditor)) { return; } if (textEditor.Saved) { return; } e.Cancel = true; var file = (textEditor.EditingFile != null ? textEditor.EditingFile.Path : DefaultFileName); await ContentDialogFactory.GetSetCloseSaveReminderDialog(file, () => { SaveButton_Click(textEditor, new RoutedEventArgs()); }, () => { e.Set.IsEnabled = false; Sets.Items?.Remove(e.Set); }).ShowAsync(); }