private void addExecute() { for (int x = 0; x < Quantity; x++) { TECSubScope subScope = null; if (underlyingTemplate != null) { subScope = AsReference ? templates.SubScopeSynchronizer.NewItem(underlyingTemplate) : new TECSubScope(underlyingTemplate); subScope.CopyPropertiesFromScope(ToAdd); foreach (IEndDevice device in ToAdd.Devices.Where(item => !originalDevices.Contains(item))) { subScope.AddDevice(device); } foreach (TECPoint point in ToAdd.Points.Where(item => !originalPoints.Contains(item))) { subScope.AddPoint(point); } } else { subScope = new TECSubScope(ToAdd); } add(subScope); if (ConnectVM != null && ConnectVM.Connect) { ConnectVM.ExecuteConnection(subScope); } Added?.Invoke(subScope); } }
private void syncSubScope(TemplateSynchronizer <TECSubScope> synchronizer, TECSubScope templateSS, TECSubScope toSync, TECChangedEventArgs args) { toSync.CopyPropertiesFromScope(templateSS); foreach (TECSubScope reference in synchronizer.GetFullDictionary()[templateSS].Where(item => item != toSync)) { reference.CopyPropertiesFromScope(toSync); } }