private void FileMenu_Save_Clicked(object sender, RoutedEventArgs e) { Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog(); if (sfd.ShowDialog() == true) { TeamObservable.Save(sfd.FileName, team); } }
//private void WindowBind() //{ // Binding bd = new Binding(); // bd.Source = researcher; // bd.Path = new PropertyPath("Name[0]"); // bd.Mode = BindingMode.OneWayToSource; // ResWindow.TextBoxName.SetBinding(TextBox.TextProperty, bd); // Binding bd1 = new Binding(); // bd1.Source = researcher; // bd1.Path = new PropertyPath("Name[1]"); // bd1.Mode = BindingMode.OneWayToSource; // ResWindow.TextBoxLastName.SetBinding(TextBox.TextProperty, bd1); // Binding bd2 = new Binding(); // bd2.Source = researcher; // bd2.Path = new PropertyPath("Date"); // bd2.Mode = BindingMode.OneWayToSource; // ResWindow.DatePick.SetBinding(DatePicker.TextProperty, bd2); // Binding bd3 = new Binding(); // bd3.Source = researcher; // bd3.Path = new PropertyPath("Topic"); // bd3.Mode = BindingMode.OneWayToSource; // ResWindow.CBox.SetBinding(ComboBox.SelectedValueProperty, bd3); // Binding bd4 = new Binding(); // bd4.Source = researcher; // bd4.Path = new PropertyPath("num"); // bd4.Mode = BindingMode.OneWayToSource; // ResWindow.Num.SetBinding(TextBox.TextProperty, bd4); // ResWindow.AddButton.Click += AddButton_Click; //} //private void Refresh(TeamObservable t) //{ // LeftListBox.ItemsSource = t; // RightListBox.ItemsSource = from item in t where item is Researcher select item; // //RightListBox.ItemTemplate = //} private void Save(TeamObservable t) { SaveFileDialog save_dialog = new SaveFileDialog(); if (save_dialog.ShowDialog() == true) { t.Change = false; TeamObservable.Save(save_dialog.FileName, t); } }
private bool SaveCollection() { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.Filter = "TeamObservable serialized object(*teamobservable)|*.teamobservable|All(*.*)|*.*"; dlg.FilterIndex = 0; dlg.OverwritePrompt = true; if (dlg.ShowDialog() == true) { team.ChangesNotSaved = false; TeamObservable.Save(dlg.FileName, this.team); // Here is no potential exception, but the file can be not saved properly. // Need a messagebox here. return(true); } else { return(false); } }
private void Save_ToFile() { if (team.IfChanged) { Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog(); var result = MessageBox.Show("Save changes? Data may be lost.", "Message", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { if (sfd.ShowDialog() == true) { TeamObservable.Save(sfd.FileName, team); team.IfChanged = false; //TextBlock_IfChanged.Text = team.IfChanged.ToString(); } } else { MessageBox.Show("Changes canceled.", "Message"); } } }