public AddInterlockVM(IInterlockable parent, TECScopeManager scopeManager) : base(scopeManager) { this.parent = parent; this.Catalogs = scopeManager.Catalogs; AddCommand = new RelayCommand(addExecute, canAdd); DeleteConnectionTypeCommand = new RelayCommand <TECElectricalMaterial>(deleteConnectiontypeExecute, canDeleteConnectionType); }
public SystemHierarchyVM(TECScopeManager scopeManager, bool canEdit) { IsTemplates = scopeManager is TECTemplates; CanEdit = canEdit; AddSystemCommand = new RelayCommand(addSystemExecute, canAddSystem); AddEquipmentCommand = new RelayCommand <TECSystem>(addEquipmentExecute, canAddEquipment); AddSubScopeCommand = new RelayCommand <TECEquipment>(addSubScopeExecute, canAddSubScope); AddPointCommand = new RelayCommand <TECSubScope>(addPointExecute, canAddPoint); AddControllerCommand = new RelayCommand <TECSystem>(addControllerExecute, canAddController); AddPanelCommand = new RelayCommand <TECSystem>(addPanelExecute, canAddPanel); AddMiscCommand = new RelayCommand <TECSystem>(addMiscExecute, canAddMisc); AddInterlockCommand = new RelayCommand <IInterlockable>(addInterlockExecute, canAddInterlock); BackCommand = new RelayCommand <object>(backExecute); AddScopeBranchCommand = new RelayCommand <TECScopeBranch>(addBranchExecute); DeleteSystemCommand = new RelayCommand <TECSystem>(deleteSystemExecute, canDeleteSystem); DeleteEquipmentCommand = new RelayCommand <TECEquipment>(deleteEquipmentExecute, canDeleteEquipment); DeleteSubScopeCommand = new RelayCommand <TECSubScope>(deleteSubScopeExecute, canDeleteSubScope); DeleteDeviceCommand = new RelayCommand <IEndDevice>(deleteDeviceExecute, canDeleteDevice); DeletePointCommand = new RelayCommand <TECPoint>(deletePointExecute, canDeletePoint); DeletePanelCommand = new RelayCommand <TECPanel>(deletePanelExecute, canDeletePanel); DeleteControllerCommand = new RelayCommand <TECController>(deleteControllerExecute, canDeleteController); DeleteInterlockCommand = new RelayCommand <TECInterlockConnection>(deleteInterlockExecute, canDeleteInterlock); catalogs = scopeManager.Catalogs; this.scopeManager = scopeManager; }
public AddSystemVM(TECScopeManager scopeManager) : base(scopeManager) { Quantity = 1; parent = scopeManager; toAdd = new TECSystem(); AddCommand = new RelayCommand(addExecute, addCanExecute); }
public AddMiscVM(TECSystem parentSystem, TECScopeManager scopeManager) : base(scopeManager) { this.scopeManager = scopeManager; parent = parentSystem; ToAdd = new TECMisc(CostType.TEC); AddCommand = new RelayCommand(addExecute, addCanExecute); }
public AddSubScopeVM(Action <TECSubScope> addMethod, TECScopeManager scopeManager) : base(scopeManager) { add = addMethod; toAdd = new TECSubScope(); setup(); PropertiesVM.DisplayReferenceProperty = false; }
public void Refresh(TECScopeManager scopeManager) { var bid = scopeManager as TECBid; var templates = scopeManager as TECTemplates; if (bid != null) { QuantityVisibility = Visibility.Visible; if (_bid != null) { _bid.MiscCosts.CollectionChanged -= MiscCosts_CollectionChanged; } bid.MiscCosts.CollectionChanged += MiscCosts_CollectionChanged; _bid = bid; sourceCollection = bid.MiscCosts; populateCollections(); } else if (templates != null) { QuantityVisibility = Visibility.Collapsed; if (templates != null) { templates.Templates.MiscCostTemplates.CollectionChanged -= MiscCosts_CollectionChanged; } templates.Templates.MiscCostTemplates.CollectionChanged += MiscCosts_CollectionChanged; _templates = templates; sourceCollection = templates.Templates.MiscCostTemplates; populateCollections(); } }
public AddPointVM(TECSubScope parentSubScope, TECScopeManager scopeManager) : base(scopeManager) { parent = parentSubScope; toAdd = new TECPoint(); ToAdd.Quantity = 1; AddCommand = new RelayCommand(addExecute, addCanExecute); }
internal bool New(TECScopeManager scopeManager) { if (!UtilitiesMethods.IsFileLocked(path)) { if (File.Exists(path)) { File.Delete(path); } if (scopeManager is TECBid) { DatabaseGenerator.CreateBidDatabase(path); } else if (scopeManager is TECTemplates) { DatabaseGenerator.CreateTemplateDatabase(path); } else { throw new Exception("Generator can only create bid or template DBs"); } List <UpdateItem> newStack = DatabaseNewStacker.NewStack(scopeManager); bool success = DatabaseUpdater.Update(path, newStack); if (!success) { MessageBox.Show("Not all items saved properly, check logs for more details."); } return(true); } else { logger.Error("Could not open file " + path + " File is open elsewhere."); return(false); } }
public PropertiesVM(TECCatalogs catalogs, TECScopeManager scopeManager) { IsTemplates = scopeManager is TECTemplates; TemplateText = "Instance Template"; DeleteConnectionTypeCommand = new RelayCommand <TECObject>(deleteConnectionTypeExecute, canDeleteConnectionType); DeleteProtocolConnectionTypeCommand = new RelayCommand <TECConnectionType>(deleteProtocolConnectionTypeExecute, canDeleteProtocolConnectionType); Refresh(catalogs, scopeManager); }
private void addControllerExecute() { var controllerTypes = Templates == null ? Bid.Catalogs.ControllerTypes: Templates.Catalogs.ControllerTypes; TECScopeManager scopeManager = Templates as TECScopeManager ?? Bid as TECScopeManager; SelectedVM = addPanelMethod != null ? new AddControllerVM(addControllerMethod, controllerTypes, scopeManager) : SelectedVM = new AddControllerVM(SelectedSystem, controllerTypes, scopeManager); }
public AddEquipmentVM(Action <TECEquipment> addMethod, TECScopeManager scopeManager) : base(scopeManager) { toAdd = new TECEquipment(); add = addMethod; AddCommand = new RelayCommand(addExecute, addCanExecute); Quantity = 1; PropertiesVM.DisplayReferenceProperty = false; }
private void addPanelExecute() { var panelTypes = Templates == null ? Bid.Catalogs.PanelTypes : Templates.Catalogs.PanelTypes; TECScopeManager scopeManager = Templates as TECScopeManager ?? Bid as TECScopeManager; SelectedVM = addPanelMethod != null ? new AddPanelVM(addPanelMethod, panelTypes, scopeManager) : SelectedVM = new AddPanelVM(SelectedSystem, panelTypes, scopeManager); }
public void Refresh(TECCatalogs catalogs, TECScopeManager scopeManager) { Catalogs = catalogs; if (scopeManager is TECBid bid) { Locations = bid.Locations; Parameters = bid.Parameters; } this.ScopeManager = scopeManager; }
public AddSubScopeVM(TECEquipment parentEquipment, TECScopeManager scopeManager) : base(scopeManager) { parent = parentEquipment; toAdd = new TECSubScope(); add = subScope => { parent.SubScope.Add(subScope); }; setup(); }
public DeltaStacker(ChangeWatcher changeWatcher, TECScopeManager manager) { dbType = DBType.Bid; if (manager is TECTemplates) { dbType = DBType.Templates; } changeWatcher.Changed += handleChange; stack = new List <UpdateItem>(); }
public ScopeCollectionsTabVM(TECScopeManager manager) { Templates = manager.Templates; this.catalogs = manager.Catalogs; SearchCollectionCommand = new RelayCommand(SearchCollectionExecute, SearchCanExecute); EndSearchCommand = new RelayCommand(EndSearchExecute); SearchString = ""; CollectionTypes = new Dictionary <AllSearchableObjects, string>(UIHelpers.SearchSelectorList); SearchCollectionExecute(); }
public ControllersPanelsVM(TECSystem system, TECScopeManager manager, bool canSelectPanel = true) : this(system, system.Controllers, system.Panels) { if (manager is TECBid) { _bid = manager as TECBid; } else { _templates = manager as TECTemplates; } PanelSelectionReadOnly = !canSelectPanel; PanelSelectionVisibility = Visibility.Visible; SelectedSystem = system; }
public EquipmentHierarchyVM(TECScopeManager scopeManager) { AddEquipmentCommand = new RelayCommand(addEquipmentExecute, canAddEquipment); AddSubScopeCommand = new RelayCommand <TECEquipment>(addSubScopeExecute, canAddSubScope); AddPointCommand = new RelayCommand <TECSubScope>(addPointExecute, canAddPoint); BackCommand = new RelayCommand <object>(backExecute); AddInterlockCommand = new RelayCommand <IInterlockable>(addInterlockExecute, canAddInterlock); DeleteEquipmentCommand = new RelayCommand <TECEquipment>(deleteEquipmentExecute, canDeleteEquipment); DeleteSubScopeCommand = new RelayCommand <TECSubScope>(deleteSubScopeExecute, canDeleteSubScope); DeleteDeviceCommand = new RelayCommand <IEndDevice>(deleteDeviceExecute, canDeleteDevice); DeletePointCommand = new RelayCommand <TECPoint>(deletePointExecute, canDeletePoint); DeleteInterlockCommand = new RelayCommand <TECInterlockConnection>(deleteInterlockExecute, canDeleteInterlock); catalogs = scopeManager.Catalogs; this.scopeManager = scopeManager; }
public SubScopeHierarchyVM(TECScopeManager scopeManager) { if (scopeManager is TECTemplates) { parent = scopeManager; } AddSubScopeCommand = new RelayCommand(addSubScopeExecute, canAddSubScope); AddPointCommand = new RelayCommand <TECSubScope>(addPointExecute, canAddPoint); AddInterlockCommand = new RelayCommand <IInterlockable>(addInterlockExecute, canAddInterlock); DeleteSubScopeCommand = new RelayCommand <TECSubScope>(deleteSubScopeExecute, canDeleteSubScope); DeleteDeviceCommand = new RelayCommand <IEndDevice>(deleteDeviceExecute, canDeleteDevice); DeletePointCommand = new RelayCommand <TECPoint>(deletePointExecute, canDeletePoint); DeleteInterlockCommand = new RelayCommand <TECInterlockConnection>(deleteInterlockExecute, canDeleteInterlock); catalogs = scopeManager.Catalogs; this.scopeManager = scopeManager; }
public void AsyncNew(TECScopeManager scopeManager) { BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (s, e) => { e.Result = catchOnRelease("Save New failed", () => { New(scopeManager); }); }; worker.RunWorkerCompleted += (s, e) => { notifySaveComplete((bool)e.Result); }; IsBusy = true; worker.RunWorkerAsync(); }
public AddEquipmentVM(TECSystem parentSystem, TECScopeManager scopeManager) : base(scopeManager) { parent = parentSystem; ExistingProposalItems = new List <TECProposalItem>(parentSystem.ProposalItems); toAdd = new TECEquipment(); add = equip => { parentSystem.Equipment.Add(equip); if (AddNewProposalItem) { parentSystem.ProposalItems.Add(new TECProposalItem(equip)); } else if (SelectedProposalItem != null) { SelectedProposalItem.ContainingScope.Add(equip); } }; AddCommand = new RelayCommand(addExecute, addCanExecute); Quantity = 1; ConnectVM = new ConnectOnAddVM(ToAdd.SubScope, parent.Controllers, scopeManager.Catalogs.ConduitTypes); }
public static TECParameters TestParameters(Random rand, TECScopeManager scopeManager = null) { Guid guid = scopeManager?.Guid ?? Guid.NewGuid(); return(new TECParameters(guid) { PMCoef = rand.NextDouble(), PMCoefStdError = rand.NextDouble(), PMRate = (rand.NextDouble() * 100), ENGCoef = rand.NextDouble(), ENGCoefStdError = rand.NextDouble(), ENGRate = (rand.NextDouble() * 100), CommCoef = rand.NextDouble(), CommCoefStdError = rand.NextDouble(), CommRate = (rand.NextDouble() * 100), SoftCoef = rand.NextDouble(), SoftCoefStdError = rand.NextDouble(), SoftRate = (rand.NextDouble() * 100), GraphCoef = rand.NextDouble(), GraphCoefStdError = rand.NextDouble(), GraphRate = (rand.NextDouble() * 100), ElectricalRate = (rand.NextDouble() * 100), ElectricalSuperRate = (rand.NextDouble() * 100), ElectricalSuperRatio = rand.NextDouble(), ElectricalNonUnionRate = (rand.NextDouble() * 100), ElectricalSuperNonUnionRate = (rand.NextDouble() * 100), IsTaxExempt = (rand.NextDouble() < .5), ElectricalIsOnOvertime = (rand.NextDouble() < .5), ElectricalIsUnion = (rand.NextDouble() < .5) }); }
public void Refresh(TECScopeManager scopeManager) { catalogs = scopeManager.Catalogs; }
/// <summary> /// Initializes a new instance of the MiscCostsVM class. /// </summary> public MiscCostsVM(TECScopeManager scopeManager) { Refresh(scopeManager); setup(); }
public void SetParentSystem(TECSystem system, TECScopeManager scopeManager) { ConnectVM = new ConnectOnAddVM(new List <TECSubScope>(), system.Controllers, scopeManager.Catalogs.ConduitTypes); updateConnectVMWithQuantity(Quantity); }
public AddControllerVM(Action <TECController> addMethod, IEnumerable <TECControllerType> controllerTypes, TECScopeManager scopeManager) : base(scopeManager) { setup(controllerTypes); add = addMethod; }
public AddPanelVM(TECSystem parentSystem, IEnumerable <TECPanelType> panelTypes, TECScopeManager scopeManager) : base(scopeManager) { Quantity = 1; parent = parentSystem; add = panel => { parent.Panels.Add(panel); }; PanelTypes = new List <TECPanelType>(panelTypes); toAdd = new TECPanel(PanelTypes[0]); AddCommand = new RelayCommand(addExecute, addCanExecute); }
public AddControllerVM(TECSystem parentSystem, IEnumerable <TECControllerType> controllerTypes, TECScopeManager scopeManager) : base(scopeManager) { setup(controllerTypes); parent = parentSystem; isTypical = parent.IsTypical; add = controller => { parent.AddController(controller); }; }
public WorkBoxVM(TECScopeManager manager) { this.manager = manager; BoxItems = new ObservableCollection <TECObject>(); ClearCommand = new RelayCommand(clearExecute, canClear); }
public AddPanelVM(Action <TECPanel> addMethod, IEnumerable <TECPanelType> panelTypes, TECScopeManager scopeManager) : base(scopeManager) { Quantity = 1; add = addMethod; PanelTypes = new List <TECPanelType>(panelTypes); toAdd = new TECPanel(PanelTypes[0]); AddCommand = new RelayCommand(addExecute, addCanExecute); }