private void miAdd_Click(object sender, RoutedEventArgs e) { if (this.Tree.SelectedItem != null) { TreeItem item = this.Tree.SelectedItem as TreeItem; AccountTypeEditor tEditor = new AccountTypeEditor(); tEditor.ParentOrgan = item.Tag as Organization; tEditor.Show(); tEditor.Closed += new EventHandler(tEditor_Closed); } }
private void miProp_Click(object sender, RoutedEventArgs e) { if (this.Tree.SelectedItem != null) { TreeItem item = this.Tree.SelectedItem as TreeItem; AccountTypeEditor tEditor = new AccountTypeEditor(); tEditor.Organization = item.Tag as Organization; tEditor.Show(); tEditor.Closed += (s, e2) => { item.Name = tEditor.Organization.Name; }; } }
void tEditor_Closed(object sender, EventArgs e) { AccountTypeEditor ate = sender as AccountTypeEditor; bool?dr = ate.DialogResult; if (dr.HasValue && (dr == true)) { int count = this.categoryList.Where(p => p.Name == ate.Organization.Name).Count(); if (count < 1) { this.categoryList.Add(ate.Organization); } } }