/// <summary> /// Selects the node's type descriptor into the property grid /// </summary> /// <param name="n"></param> private void SelectPropertyDescriptorForNodeIntoPropertyGrid(CategoryTreeNode n) { if (this.InvokeRequired) { this.Invoke(new SelectPropertyDescriptorForNodeIntoPropertyGridInvoker(this.SelectPropertyDescriptorForNodeIntoPropertyGrid), new object[] { n }); return; } try { _propertyGrid.SelectedObject = null; _labelCategory.Text = null; if (n != null) { if (n.Categories.Count > 0) { XmlConfigurationOptionCollectionTypeDescriptor td = new XmlConfigurationOptionCollectionTypeDescriptor(n.Categories); if (td != null) { _propertyGrid.SelectedObject = td; } foreach (DictionaryEntry entry in n.Categories) { XmlConfigurationCategory category = entry.Value as XmlConfigurationCategory; if (category != null) { _labelCategory.Text = category.DisplayName; break; } } } } } catch (System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } }
/// <summary> /// Selects the node's type descriptor into the property grid /// </summary> /// <param name="n"></param> private void SelectPropertyDescriptorForNodeIntoPropertyGrid(CategoryTreeNode n) { if (this.InvokeRequired) { this.Invoke(new SelectPropertyDescriptorForNodeIntoPropertyGridInvoker(this.SelectPropertyDescriptorForNodeIntoPropertyGrid), new object[] {n}); return; } try { _propertyGrid.SelectedObject = null; _labelCategory.Text = null; if (n != null) { if (n.Categories.Count > 0) { XmlConfigurationOptionCollectionTypeDescriptor td = new XmlConfigurationOptionCollectionTypeDescriptor(n.Categories); if (td != null) _propertyGrid.SelectedObject = td; foreach(DictionaryEntry entry in n.Categories) { XmlConfigurationCategory category = entry.Value as XmlConfigurationCategory; if (category != null) { _labelCategory.Text = category.DisplayName; break; } } } } } catch(System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } }