//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; }
public TypicalHierarchyVM(TECBid bid, ChangeWatcher watcher) { this.bid = bid; SystemHierarchyVM = new SystemHierarchyVM(bid, false); SystemHierarchyVM.Selected += systemHierarchyVM_Selected; SystemHierarchyVM.SetDeleteCommand( sys => { SelectedTypical.Instances.Remove(sys); }, sys => { return(SelectedTypical != null); }); TypicalSystems = new ObservableCollection <TECTypical>(bid.Systems.Where(x => x.Instances.Count != 1)); Singletons = new ObservableCollection <TECTypical>(bid.Systems.Where(x => x.Instances.Count == 1)); AddInstanceCommand = new RelayCommand(addInstanceExecute, canAddInstance); InstanceTypicalCommand = new RelayCommand <TECTypical>(instanceExecute, canInstanceExecute); watcher.Changed += handleChanged; }