void catDev_CategorySelected(CategorySelectedEventArgs e) { try { switch (e.CategoryIsSelected) { case false: if (this.gl_catDefLst.ContainsKey(e.CategoryId)) { this.gl_catDefLst.Remove(e.CategoryId); this.CategoryDeSelected(new CategorySelectedEventArgs(e.CategoryId, e.CategoryName, false, e.ParentId)); #if DEBUG System.Diagnostics.Debug.WriteLine("Removed selected category from list. Category Id: {0}", e.CategoryId.ToString()); #endif } break; case true: if (!this.gl_catDefLst.ContainsKey(e.CategoryId)) { if (this.gl_lockCnt > this.gl_catDefLst.Count || this.gl_lockCnt == 0) { if (this.gl_lockOutParentNodes == false) { this.gl_catDefLst.Add(e.CategoryId, new CategoryDef(e.CategoryName, e.CategoryId, e.ParentId)); this.CategorySelected(new CategorySelectedEventArgs(e.CategoryId, e.CategoryName, true, e.ParentId)); #if DEBUG System.Diagnostics.Debug.WriteLine("Added selected category from list. Category Id: {0}", e.CategoryId.ToString()); #endif } else { if (this.gl_xDoc != null) { try { var parentQueryNode = from parentNode in this.gl_xDoc.Root.Descendants("Category") where parentNode.Attribute("Id").Value == e.CategoryId select parentNode; foreach (var parentNode in parentQueryNode) { if (parentNode.HasElements == true) { try { CategoryIdDevice catIdDev = null; if (this.gl_catDevLst.TryGetValue(e.CategoryId, out catIdDev) == true) { catIdDev.xIsEnabledChk.IsChecked = false; } MessageBox.Show("You may not choose parent categories. Please continue to expand the categories and choose child nodes.", "Parent Category Selection Not Allowed", MessageBoxButton.OK); } #if DEBUG catch (Exception caex) { System.Diagnostics.Debug.WriteLine("Parent Node Lockout Failure: {0}", string.Format("Category could not be switched off (UI control). Category Id: {0} Category Name: {1}\nXDocument: {2}\n\nError: {3}", e.CategoryId, e.CategoryName, this.gl_xDoc.ToString(), caex.ToString())); } #else catch { } #endif } else { this.gl_catDefLst.Add(e.CategoryId, new CategoryDef(e.CategoryName, e.CategoryId, e.ParentId)); this.CategorySelected(new CategorySelectedEventArgs(e.CategoryId, e.CategoryName, true, e.ParentId)); #if DEBUG System.Diagnostics.Debug.WriteLine("Added selected category from list. Category Id: {0}", e.CategoryId.ToString()); #endif } break; } } catch { try { } catch { } } } else { this.gl_catDefLst.Add(e.CategoryId, new CategoryDef(e.CategoryName, e.CategoryId, e.ParentId)); this.CategorySelected(new CategorySelectedEventArgs(e.CategoryId, e.CategoryName, true, e.ParentId)); #if DEBUG System.Diagnostics.Debug.WriteLine("Added selected category from list. Category Id: {0}", e.CategoryId.ToString()); #endif } } } else { CategoryIdDevice catIdDev = null; if (this.gl_catDevLst.TryGetValue(e.CategoryId, out catIdDev) == true) { catIdDev.xIsEnabledChk.IsChecked = false; } MessageBox.Show("You have reached your selection limit. Limit: " + this.gl_lockCnt.ToString(), "Category Selection Limit", MessageBoxButton.OK); } } break; } } catch { } }
private void catLstCtrl_CategorySelected(CategorySelectedEventArgs e) { // }
void CategoryListCtrl_CategoryDeSelected(CategorySelectedEventArgs e) { // }
void CategoryIdDevice_CategorySelected(CategorySelectedEventArgs e) { // }