예제 #1
0
        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;
            }
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
 private void SaveFile_OnClick(object sender, RoutedEventArgs e)
 {
     SaveService.OnSave(ref _fileName, NotepadField.Text);
     SaveStatusUpdate(true);
 }