//Copy Constructor public TECSubScope(TECSubScope sourceSubScope, Dictionary <Guid, Guid> guidDictionary = null, ObservableListDictionary <ITECObject> characteristicReference = null) : this() { if (guidDictionary != null) { guidDictionary[_guid] = sourceSubScope.Guid; } foreach (IEndDevice device in sourceSubScope.Devices) { Devices.Add(device); } foreach (TECPoint point in sourceSubScope.Points) { var toAdd = new TECPoint(point); characteristicReference?.AddItem(point, toAdd); Points.Add(toAdd); } foreach (TECInterlockConnection interlock in sourceSubScope.Interlocks) { var toAdd = new TECInterlockConnection(interlock); characteristicReference?.AddItem(interlock, toAdd); Interlocks.Add(toAdd); } foreach (TECScopeBranch branch in sourceSubScope.ScopeBranches) { var toAdd = new TECScopeBranch(branch); characteristicReference?.AddItem(branch, toAdd); ScopeBranches.Add(toAdd); } this.copyPropertiesFromScope(sourceSubScope); }
void ITypicalable.AddChildForProperty(string property, ITECObject item) { if (property == "Points" && item is TECPoint point) { AddPoint(point); } else if (property == "Devices" && item is IEndDevice device) { Devices.Add(device); } else if (property == "Interlocks" && item is TECInterlockConnection interlock) { Interlocks.Add(interlock); } else if (property == "ScopeBranches" && item is TECScopeBranch branch) { ScopeBranches.Add(branch); } else { this.AddChildForScopeProperty(property, item); } }