private async void Save(object sender, RoutedEventArgs e) { string name = noteName.Text; if (name.StartsWith(" ") && name.EndsWith(" ")) { MessageBox.Show("Название не может начинаться с пробелов!"); } else { Notice newNotice = new Notice { Name = name, }; NoticesExplorer.notices.Notices.Add(newNotice); await NoticesExplorer.SaveNotesToJson(); } }
private async void Save(object sender, RoutedEventArgs e) { string name = pointName.Text; if (name.StartsWith(" ") && name.EndsWith(" ")) { MessageBox.Show("Название не может начинаться с пробелов!"); } else { Point newPoint = new Point { Name = name, Content = new NoticeDomain.Content { Text = "Hello, world!" } }; NoticesExplorer.notices.Notices.Where(x => x.Name.Equals(NoticesExplorer.selectedNotice.Name)).FirstOrDefault().Points.Add(newPoint); await NoticesExplorer.SaveNotesToJson(); } }
private void SaveContent(object sender, RoutedEventArgs e) { ((Point)pointsDataGrid.SelectedItem).Content.Text = contentTextBox.Text; NoticesExplorer.notices.Notices = noticesDataGrid.ItemsSource as List <Notice>; NoticesExplorer.SaveNotesToJson(); }
public async void InitInfo() { NoticesExplorer.notices = await NoticesExplorer.GetNotesFromJson(); noticesDataGrid.ItemsSource = NoticesExplorer.notices.Notices; }