/// <summary> /// Set the compound part for the logical groups creation process /// </summary> /// <param name="obj">The TxObjEditBoxControl of the view</param> private void CompoundPartPickedExecuted(object obj) { if (obj is TxObjEditBoxControl wpfControl) { TxCompoundPart compoundPart = wpfControl.Object as TxCompoundPart; if (compoundPart != null) { logicalGroups = new Dictionary <string, TxObjectList>(); TraverseCompoundPart(compoundPart); ConvertDictionaryToObservableCollection(); } else { LogicalGroupsData.Clear(); } } }
/// <summary> /// Traverse the Compound part and add the components to the dictionary. /// Empty omponents are skipped! /// </summary> /// <param name="compoundPart">The selected compund part</param> private void TraverseCompoundPart(TxCompoundPart compoundPart) { if (compoundPart.Count > 0) { foreach (var item in compoundPart) { if (item is TxCompoundPart subCompoundPart) { //Recursive call of TraverseCompoundPart TraverseCompoundPart(subCompoundPart); } else if (item is TxComponent component) { GroupComponent(component); } } } }