示例#1
0
        //Initializer
        public ScopeEditorVM(TECBid bid, ChangeWatcher watcher)
        {
            Bid = bid;

            ScopeCollection              = new ScopeCollectionsTabVM(Bid);
            ScopeCollection.DragHandler += DragOver;
            ScopeCollection.DropHandler += Drop;

            setupControllersPanelsTab();
            setupMiscVM();
            TypicalEditVM           = new SystemHierarchyVM(bid, true);
            TypicalEditVM.Selected += item =>
            {
                Selected = item;
            };
            InstanceEditVM           = new TypicalHierarchyVM(bid, watcher);
            InstanceEditVM.Selected += item => {
                Selected = item;
            };
            PropertiesVM  = new PropertiesVM(bid.Catalogs, bid);
            WorkBoxVM     = new WorkBoxVM(bid);
            ConnectionsVM = new ConnectionsVM(bid, watcher, bid.Catalogs, locations: bid.Locations, filterPredicate: filterPredicate);

            bool filterPredicate(ITECObject obj)
            {
                if (obj is ITypicalable typable)
                {
                    return(typable is TECTypical || !typable.IsTypical);
                }
                else if (obj is TECScopeTemplates || obj is TECCatalogs)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            ConnectionsVM.Selected += item =>
            {
                Selected = item;
            };
            DGTabIndex          = GridIndex.Systems;
            TemplatesVisibility = Visibility.Visible;
        }
示例#2
0
 private void SystemSelected(TECSystem value)
 {
     if (value != null)
     {
         MiscVM = new MiscCostsVM(value);
         ControllersPanelsVM = new ControllersPanelsVM(value, scopeManager);
         ValveVM             = new ValveSelectionVM(value, scopeManager.Catalogs.Valves);
         ConnectionsVM       = new ConnectionsVM(value, new ChangeWatcher(value), catalogs, locations: (scopeManager as TECBid)?.Locations, filterPredicate: connectionFilter);
         if (value is TECTypical typical && typical.Instances.Count > 1)
         {
             UpdateInstanceConnectionsCommand = new RelayCommand(typical.UpdateInstanceConnections, typical.CanUpdateInstanceConnections);
         }
         else
         {
             UpdateInstanceConnectionsCommand = null;
         }
         RaisePropertyChanged("UpdateInstanceConnectionsCommand");
         bool connectionFilter(ITECObject obj)
         {
             if (obj is ITypicalable typ && typ.IsTypical == value.IsTypical)
             {
                 return(true);
             }