public void SaveCommand_Executed(object sender, RoutedEventArgs e) { SaveFileDialog mSaveFileDialog = new SaveFileDialog(); mSaveFileDialog.Filter = "XML Files (*.xml)|*.xml|All files (*.*)|*.*"; //mSaveFileDialog.InitialDirectory = @ToDoApplication.FOLDER_LOCATION; if (mSaveFileDialog.ShowDialog() == true) { string path = mSaveFileDialog.FileName; SaveFileCommand SaveFileCommand = new SaveFileCommand(this, path); SaveFileCommand.Execute(); this.ViewableTasks.View.Refresh(); } }
private void ToolbarButton_Click(object sender, RoutedEventArgs e) { try { switch ((sender as FrameworkElement).Tag.ToString().Replace("toolbar.", "")) { case "new": NewFileCommand.Execute(null); break; case "open": OpenFileCommand.Execute(null); break; case "save": SaveFileCommand.Execute(null); break; case "cut": CutCommand.Execute(null); break; case "copy": CopyCommand.Execute(null); break; case "paste": PasteCommand.Execute(null); break; case "build": BuildRunCommand.Execute(false); break; case "buildrun": BuildRunCommand.Execute(true); break; case "close": CloseTabCommand.Execute(null); break; } } catch (Exception ex) { Debug.Fail(ex.Message); } }
bool OrganizerHasChanged() { if (OrganizerVM != null && OrganizerVM.HasChanged) { var r = System.Windows.MessageBox.Show("Save changes?", "There are unsaved changes. Save first?", System.Windows.MessageBoxButton.YesNoCancel); if (r == System.Windows.MessageBoxResult.Yes) { SaveFileCommand.Execute(null); if (OrganizerVM.HasChanged) { return(true); } } else if (r == System.Windows.MessageBoxResult.Cancel) { return(true); } } return(false); }
/// <summary> /// Checks wether or not the currently loaded Controller has changes. If it does, /// the method offers the user to save them. /// </summary> /// <returns>True if there are unsaved changes, false if there are not or if /// the user decides to discard them.</returns> public bool ControllerHasChanged() { if (ControllerVM != null && ControllerVM.HasChanged) { System.Windows.MessageBoxResult r = System.Windows.MessageBox.Show("Wijzigingen opslaan?", "De regeling is gewijzigd. Opslaan?", System.Windows.MessageBoxButton.YesNoCancel); if (r == System.Windows.MessageBoxResult.Yes) { SaveFileCommand.Execute(null); if (ControllerVM.HasChanged) { return(true); } } else if (r == System.Windows.MessageBoxResult.Cancel) { return(true); } } return(false); }
public void SaveCommand_Executed(object sender, RoutedEventArgs e) { SaveFileDialog mSaveFileDialog = new SaveFileDialog(); mSaveFileDialog.Filter = "XML Files (*.xml)|*.xml|All files (*.*)|*.*"; if (mSaveFileDialog.ShowDialog() == true) { string path = mSaveFileDialog.FileName; System.Threading.Tasks.Task.Factory.StartNew(() => { try { SaveFileCommand SaveFileCommand = new SaveFileCommand(this, path); SaveFileCommand.Execute(); } catch (AggregateException error) { MessageBox.Show(error.Message); } }).Wait(); MessageBox.Show("Save Completed!", "Save", MessageBoxButton.OK, MessageBoxImage.Information); } }
public void SaveMappingsFile(object sender, RoutedEventArgs arguments) { var saveCommand = new SaveFileCommand(_current); saveCommand.Execute(arguments); }