/*private void Handler_CollectionChanged(object sender, NotifyCollectionChangedEventArgs arg) * { * //Projects.ItemsSource = RS.Projects; * //Projects.ItemsSource = RS; * //AllCollection.ItemsSource = RS; * }*/ private void Openfile_Click(object sender, RoutedEventArgs e) //меняться AmountOfWork { OpenFileDialog dialog = new OpenFileDialog(); if (dialog.ShowDialog() == true) { if (RS.IsChanged == true) { const string message = "Выйти без сохранения?"; MessageBoxResult res = MessageBox.Show(message, "Exit", MessageBoxButton.YesNo); //обрабатывать YesNO if (res == MessageBoxResult.No) { SaveFileDialog dialogS = new SaveFileDialog(); if (dialogS.ShowDialog() == true) { ResearcherObservable.Save(dialogS.FileName, RS); } } } ResearcherObservable.Load(dialog.FileName, ref RS); this.DataContext = RS; RS.IsChanged = false;//десериализация } }
private void Open_Clicked(object sender, RoutedEventArgs e) { Save(); Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); if (ofd.ShowDialog() == true) { ResearcherObservable.Load(ofd.FileName, ref obj); Update_Items(); } }