private void MenuItem_Click_ContactsUpdate(object sender, RoutedEventArgs e) { ListViewItem selectedListViewItem = listView.SelectedItem as ListViewItem; TreeViewItem selectedTreeViewItem = treeView.SelectedItem as TreeViewItem; Person selectedPerson = new Person(); if (selectedListViewItem == null && selectedTreeViewItem == null) { MessageBox.Show("Nothing is Selected"); return; } else if (selectedListViewItem != null && selectedTreeViewItem == null) { selectedPerson = selectedListViewItem.Tag as Person; } else if (selectedListViewItem == null && selectedTreeViewItem != null) { selectedPerson = selectedTreeViewItem.Tag as Person; } PersonWindow personWindow = new PersonWindow(ref services, ref selectedPerson, EditMode.Update); personWindow.ShowDialog(); LoadData(services.GetGroups()); }
private void MenuItem_Click_ContactsNew(object sender, RoutedEventArgs e) { Person newPerson = new Person(); PersonWindow personWindow = new PersonWindow(ref services, ref newPerson, EditMode.New); personWindow.ShowDialog(); LoadData(services.GetGroups()); }