public static void FilterOutGeneralProperties(this Dictionary <string, List <RXClass> > propertyClassesMap, Dictionary <RXClass, StringCollection> classPropertiesMap) { StringCollection generalPropertyNames = propertyClassesMap.GetGeneralPropertyNames(); foreach (RXClass objectType in classPropertiesMap.Keys) { for (int i = classPropertiesMap[objectType].Count - 1; i >= 0; --i) { string prop = classPropertiesMap[objectType][i]; if (generalPropertyNames.Contains(prop)) { classPropertiesMap[objectType].RemoveAt(i); } } } }
public static void FilterOutSingleProperties(this Dictionary <string, List <RXClass> > propertyClassesMap) { StringCollection generalPropertyNames = propertyClassesMap.GetGeneralPropertyNames(); StringCollection singlePropertyNames = new StringCollection(); foreach (string prop in propertyClassesMap.Keys) { if (!generalPropertyNames.Contains(prop)) { singlePropertyNames.Add(prop); } } foreach (string prop in singlePropertyNames) { propertyClassesMap.Remove(prop); } }
// Fill the property tree with the property definition sets defined in the previous wizard sheet. void FillPropertyTree() { treeProperties.Nodes.Clear(); // Add a "General" node which contains common properties that are scheduled across different classes. Dictionary <string, List <RXClass> > propertyClassesMap = runtimeData.classPropertiesMap.GroupClassesByProperty(); if (propertyClassesMap.ContainsGeneralProperty()) { TreeNode headerNode = treeProperties.Nodes.Add("General"); StringCollection generalProperties = propertyClassesMap.GetGeneralPropertyNames(); foreach (string propName in generalProperties) { AddPropertyToNodeCollection(headerNode.Nodes, propertyClassesMap[propName], propName); } } // Now we add properties grouped by class Dictionary <RXClass, StringCollection> newClassPropertiesMap = runtimeData.classPropertiesMap.DeepClone(); propertyClassesMap.FilterOutGeneralProperties(newClassPropertiesMap); // we only need the properties that are not shared across classes at this stage foreach (RXClass objectType in newClassPropertiesMap.Keys) { if (newClassPropertiesMap[objectType].Count == 0) { continue; } TreeNode newNode = treeProperties.Nodes.Add(ScheduleSample.GetDisplayName(objectType)); StringCollection propertyNames = newClassPropertiesMap[objectType]; foreach (string propertyName in propertyNames) { AddPropertyToNodeCollection(newNode.Nodes, objectType, propertyName); } } treeProperties.ExpandAll(); }