public MainWindow() { InitializeComponent(); DataContext = this; library = new SRL(); Update(); ClearUnsavedFlag(); }
private void mi_newLibrary_Click(object sender, RoutedEventArgs e) { if (hasChangedSinceSave) { if (MessageBox.Show("There are unsaved changes in the library! Are you sure you want to close this library?", "Warning!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } } hasChangedSinceSave = false; library = new SRL(); Update(); ClearUnsavedFlag(); }
private void mi_loadLibrary_Click(object sender, RoutedEventArgs e) { if (hasChangedSinceSave) { if (MessageBox.Show("There are unsaved changes in the library! Are you sure you want to close this library?", "Warning!", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } } OpenFileDialog dialog = new OpenFileDialog(); dialog.InitialDirectory = Environment.CurrentDirectory + @"\Created Libraries"; dialog.CheckFileExists = true; if (dialog.ShowDialog() == true) { library = SRL.Load(dialog.FileName); Update(); ClearUnsavedFlag(); } }