void CategoryListCtrl_CategoryRemoved(object sender, CategoryDeletedEventArgs e) { // }
void catLstCtrl_CategoryRemoved(object sender, CategoryDeletedEventArgs e) { try { if (e.ParentId != "{ROOT}") { try { var lookupQuery = from category in this.gl_xDoc.Descendants("Category") where category.Attribute("Id").Value == e.ParentId select category; foreach (var category in lookupQuery) { #if DEBUG System.Diagnostics.Debug.WriteLine("Category was found and removed"); #endif category.Remove(); break; } } #if DEBUG catch(Exception e2) { MessageBox.Show(string.Format("Error: {0}", e2.ToString())); } #else catch { MessageBox.Show("An error occured while trying to remove your category. It may not have been removed.", "Error"); } #endif } } catch { } this.CommitChanges(); }