private void MainWindow_OnClosing(object sender, CancelEventArgs e) { if (_isSaved) { return; } var answer = MessageBox.Show( "Save changed?", "Save", MessageBoxButton.YesNoCancel, MessageBoxImage.Question ); switch (answer) { case MessageBoxResult.Yes: SaveService.OnSave(ref _fileName, NotepadField.Text); break; case MessageBoxResult.Cancel: e.Cancel = true; break; } }
private void MainWindow_OnKeyDown(object sender, KeyEventArgs e) { if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.S) { SaveService.OnSave(ref _fileName, NotepadField.Text); SaveStatusUpdate(true); } }
private void SaveFile_OnClick(object sender, RoutedEventArgs e) { SaveService.OnSave(ref _fileName, NotepadField.Text); SaveStatusUpdate(true); }