Exemple #1
0
 void ITypicalable.AddChildForProperty(string property, ITECObject item)
 {
     if (property == "Controllers" && item is TECController controller)
     {
         AddController(controller);
     }
     else if (property == "Equipment" && item is TECEquipment equipment)
     {
         Equipment.Add(equipment);
     }
     else if (property == "Panels" && item is TECPanel panel)
     {
         Panels.Add(panel);
     }
     else if (property == "MiscCosts" && item is TECMisc misc)
     {
         MiscCosts.Add(misc);
     }
     else if (property == "ScopeBranches" && item is TECScopeBranch branch)
     {
         ScopeBranches.Add(branch);
     }
     else if (property == "ProposalItems" && item is TECProposalItem propItem)
     {
         ProposalItems.Add(propItem);
     }
     else
     {
         this.AddChildForScopeProperty(property, item);
     }
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 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);
 }
Exemple #4
0
        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);
        }