public TECSystem(TECSystem source, Dictionary <Guid, Guid> guidDictionary = null, ObservableListDictionary <ITECObject> characteristicReference = null, Tuple <TemplateSynchronizer <TECEquipment>, TemplateSynchronizer <TECSubScope> > synchronizers = null) : this() { if (guidDictionary == null) { guidDictionary = new Dictionary <Guid, Guid>(); } guidDictionary[_guid] = source.Guid; foreach (TECEquipment equipment in source.Equipment) { var toAdd = new TECEquipment(equipment, guidDictionary, characteristicReference, ssSynchronizer: synchronizers?.Item2); if (synchronizers != null && synchronizers.Item1.Contains(equipment)) { synchronizers.Item1.LinkNew(synchronizers.Item1.GetTemplate(equipment), toAdd); } if (characteristicReference != null) { characteristicReference.AddItem(equipment, toAdd); } Equipment.Add(toAdd); } foreach (TECController controller in source._controllers) { var toAdd = controller.CopyController(guidDictionary); if (characteristicReference != null) { characteristicReference.AddItem(controller, toAdd); } _controllers.Add(toAdd); } foreach (TECPanel panel in source.Panels) { var toAdd = new TECPanel(panel, guidDictionary); if (characteristicReference != null) { characteristicReference.AddItem(panel, toAdd); } Panels.Add(toAdd); } foreach (TECMisc misc in source.MiscCosts) { var toAdd = new TECMisc(misc); MiscCosts.Add(toAdd); } foreach (TECScopeBranch branch in source.ScopeBranches) { var toAdd = new TECScopeBranch(branch); ScopeBranches.Add(toAdd); } foreach (TECProposalItem item in source.ProposalItems) { var toAdd = new TECProposalItem(item, guidDictionary); ProposalItems.Add(toAdd); } this.copyPropertiesFromLocated(source); ModelLinkingHelper.LinkSystem(this, guidDictionary); }
public TECSystem AddInstance() { Dictionary <Guid, Guid> guidDictionary = new Dictionary <Guid, Guid>(); var newSystem = new TECSystem(); newSystem.CopyPropertiesFromScope(this); if (this.Location != null) { newSystem.Location = this.Location; } foreach (TECEquipment equipment in Equipment) { var toAdd = new TECEquipment(equipment, guidDictionary, TypicalInstanceDictionary); TypicalInstanceDictionary.AddItem(equipment, toAdd); newSystem.Equipment.Add(toAdd); } foreach (TECController controller in Controllers) { var toAdd = controller.CopyController(guidDictionary); TypicalInstanceDictionary.AddItem(controller, toAdd); newSystem.AddController(toAdd); } foreach (TECPanel panel in Panels) { var toAdd = new TECPanel(panel, guidDictionary); TypicalInstanceDictionary.AddItem(panel, toAdd); newSystem.Panels.Add(toAdd); } foreach (TECMisc misc in MiscCosts) { var toAdd = new TECMisc(misc); TypicalInstanceDictionary.AddItem(misc, toAdd); newSystem.MiscCosts.Add(toAdd); } foreach (TECScopeBranch branch in ScopeBranches) { var toAdd = new TECScopeBranch(branch); TypicalInstanceDictionary.AddItem(branch, toAdd); newSystem.ScopeBranches.Add(toAdd); } //Proposal items are not currently synced to instances //foreach(TECProposalItem propItem in ProposalItems) //{ // var toAdd = new TECProposalItem(propItem); // TypicalInstanceDictionary.AddItem(propItem, toAdd); // newSystem.ProposalItems.Add(toAdd); //} ModelLinkingHelper.LinkSystem(newSystem, guidDictionary); Instances.Add(newSystem); return(newSystem); }
public TECTypical(TECTypical source, Dictionary <Guid, Guid> guidDictionary = null, ObservableListDictionary <ITECObject> characteristicReference = null) : this() { if (guidDictionary != null) { guidDictionary[_guid] = source.Guid; } foreach (TECEquipment equipment in source.Equipment) { var toAdd = new TECEquipment(equipment, guidDictionary, characteristicReference); if (characteristicReference != null) { characteristicReference.AddItem(equipment, toAdd); } Equipment.Add(toAdd); } foreach (TECController controller in source.Controllers) { var toAdd = controller.CopyController(guidDictionary); if (characteristicReference != null) { characteristicReference.AddItem(controller, toAdd); } AddController(toAdd); } foreach (TECPanel panel in source.Panels) { var toAdd = new TECPanel(panel, guidDictionary); if (characteristicReference != null) { characteristicReference.AddItem(panel, toAdd); } Panels.Add(toAdd); } foreach (TECMisc misc in source.MiscCosts) { var toAdd = new TECMisc(misc); MiscCosts.Add(toAdd); } foreach (TECScopeBranch branch in source.ScopeBranches) { var toAdd = new TECScopeBranch(branch); ScopeBranches.Add(toAdd); } copyPropertiesFromLocated(source); }
public TECTypical(TECSystem system, TECScopeManager manager) : this() { Dictionary <Guid, Guid> guidDictionary = new Dictionary <Guid, Guid>(); guidDictionary[_guid] = system.Guid; foreach (TECEquipment equipment in system.Equipment) { var toAdd = new TECEquipment(equipment, guidDictionary); Equipment.Add(toAdd); } foreach (TECController controller in system.Controllers) { var toAdd = controller.CopyController(guidDictionary); AddController(toAdd); } foreach (TECPanel panel in system.Panels) { var toAdd = new TECPanel(panel, guidDictionary); Panels.Add(toAdd); } foreach (TECMisc misc in system.MiscCosts) { var toAdd = new TECMisc(misc); MiscCosts.Add(toAdd); } foreach (TECScopeBranch branch in system.ScopeBranches) { var toAdd = new TECScopeBranch(branch); ScopeBranches.Add(toAdd); } foreach (TECProposalItem item in system.ProposalItems) { var toAdd = new TECProposalItem(item, guidDictionary); ProposalItems.Add(toAdd); } copyPropertiesFromLocated(system); ModelLinkingHelper.LinkSystem(this, guidDictionary); }
public TECMisc(TECMisc miscSource) : this(miscSource.Type) { copyPropertiesFromCost(miscSource); _quantity = miscSource.Quantity; }
private void NotifyMiscChanged(TECMisc newMisc, TECMisc oldMisc) { CostBatch delta = newMisc.CostBatch - oldMisc.CostBatch; notifyCostChanged(delta); }