private void Window_Loaded(object sender, RoutedEventArgs e) { IOservice = new JsonIOservice(); try { tasksClasses = IOservice.LoadTasks(); } catch (Exception ex) { MessageBox.Show(ex.Message); Close(); } AddTasksDate(); tasksClasses.CollectionChanged += Collection_Changed; MainDataGrid.ItemsSource = tasksClasses; }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { contacts = jsonIO.LoadContacts(); } catch (Exception ex) { MessageBox.Show(ex.Message); Close(); } contacts.CollectionChanged += Collection_Changed; if (contacts.Count <= 0) { AddContactRange(CreateRandomContacts.GetContacts(new Random().Next(1, 100))); } DataGridInfo.ItemsSource = contacts; }