Пример #1
0
 public TECEstimator(TECObject initalObject, TECParameters parameters, TECExtraLabor extraLabor, Double duration, ChangeWatcher watcher) : base(Guid.NewGuid())
 {
     this.duration               = duration;
     this.parameters             = parameters;
     parameters.PropertyChanged += memberObjectChanged;
     this.extraLabor             = extraLabor;
     extraLabor.PropertyChanged += memberObjectChanged;
     getInitialValues(initalObject);
     watcher.CostChanged  += costChanged;
     watcher.PointChanged += pointChanged;
 }
Пример #2
0
 private void removeChildFromScope(TECScope scope, TECObject child)
 {
     if (child is TECAssociatedCost cost)
     {
         scope.AssociatedCosts.Remove(cost);
     }
     else if (child is TECTag tag)
     {
         scope.Tags.Remove(tag);
     }
     else
     {
         throw new NotImplementedException("Scope child isn't cost or tag.");
     }
 }
Пример #3
0
        public bool IsTemplateObject(TECObject item)
        {
            if (item is TECSubScope subScope)
            {
                bool isTemplate = Templates.SubScopeTemplates.Contains(subScope);

                bool isTemplated = Templates.SubScopeTemplates.Contains(SubScopeSynchronizer.GetParent(subScope)) ||
                                   Templates.SubScopeTemplates.Contains(SubScopeSynchronizer.GetParent(SubScopeSynchronizer.GetParent(subScope)));
                return(isTemplate || isTemplated);
            }
            else if (item is TECEquipment equipment)
            {
                return(Templates.EquipmentTemplates.Contains(equipment) || EquipmentSynchronizer.Contains(equipment));
            }
            else if (item is TECController controller)
            {
                return(Templates.ControllerTemplates.Contains(controller));
            }
            else if (item is TECPanel panel)
            {
                return(Templates.PanelTemplates.Contains(panel));
            }
            else if (item is TECMisc misc)
            {
                return(Templates.MiscCostTemplates.Contains(misc));
            }
            else if (item is TECParameters parameters)
            {
                return(Templates.Parameters.Contains(parameters));
            }
            else if (item is TECSystem system)
            {
                return(Templates.SystemTemplates.Contains(system));
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
 private void scopeChildRemoved(TECObject child)
 {
     foreach (TECElectricalMaterial type in Catalogs.ConnectionTypes)
     {
         removeChildFromScope(type, child);
         if (child is TECAssociatedCost cost)
         {
             type.RatedCosts.Remove(cost);
         }
     }
     foreach (TECElectricalMaterial type in Catalogs.ConduitTypes)
     {
         removeChildFromScope(type, child);
         if (child is TECAssociatedCost cost)
         {
             type.RatedCosts.Remove(cost);
         }
     }
     foreach (TECPanelType type in Catalogs.PanelTypes)
     {
         removeChildFromScope(type, child);
     }
     foreach (TECControllerType type in Catalogs.ControllerTypes)
     {
         removeChildFromScope(type, child);
     }
     foreach (TECIOModule module in Catalogs.IOModules)
     {
         removeChildFromScope(module, child);
     }
     foreach (TECDevice dev in Catalogs.Devices)
     {
         removeChildFromScope(dev, child);
     }
     foreach (TECSystem sys in Templates.SystemTemplates)
     {
         removeChildFromScope(sys, child);
         foreach (TECEquipment equip in sys.Equipment)
         {
             removeChildFromScope(equip, child);
             foreach (TECSubScope ss in equip.SubScope)
             {
                 removeChildFromScope(ss, child);
             }
         }
     }
     foreach (TECEquipment equip in Templates.EquipmentTemplates)
     {
         removeChildFromScope(equip, child);
         foreach (TECSubScope ss in equip.SubScope)
         {
             removeChildFromScope(ss, child);
         }
     }
     foreach (TECSubScope ss in Templates.SubScopeTemplates)
     {
         removeChildFromScope(ss, child);
     }
     foreach (TECController controller in Templates.ControllerTemplates)
     {
         removeChildFromScope(controller, child);
     }
     foreach (TECPanel panel in Templates.PanelTemplates)
     {
         removeChildFromScope(panel, child);
     }
 }