public VMHostTreeViewModel(VMModel model) : base() { this.vmHostModel = model; this.View = new VMHostTreeView(); vmHostGroups = new List <VMHostGroup>(1); vmHostGroups.Add(model.RootVMHostGroup); AddHostCommand = new DelegateCommand <object>(AddHost, CanAddHost); RemoveVMHostTreeNodeCommand = new DelegateCommand <object>(RemoveVMHostTreeNode, CanRemoveVMHostTreeNode); VMHostGroupCreate = new DelegateCommand <object>(CreateVMHostGroup, CanCreateVMHostGroup); RenameTreeNode = new DelegateCommand <object>(RenameNode, CanRenameNode); MoveToGroupCommand = new DelegateCommand <object>(MoveToGroup, CanMoveToGroup); CanExecuteRaisers = new List <Action> { AddHostCommand.RaiseCanExecuteChanged, RemoveVMHostTreeNodeCommand.RaiseCanExecuteChanged, VMHostGroupCreate.RaiseCanExecuteChanged, RenameTreeNode.RaiseCanExecuteChanged, MoveToGroupCommand.RaiseCanExecuteChanged }; model.VMHostTreeChanged += (o, e) => { OnPropertyChanged("VMHostGroups"); }; View.SetViewModel(this); ActionsView = new VMHostTreeActionsView(this); }
public static VMModel GetInstance() { if (instance == null) { instance = new VMModel(); } return(instance); }
public VMHostListViewModel(VMModel model, ObservableCollection <VMHost> hostList) { Model = model; this.HostList = hostList; Model.ActiveVMHostList.Clear(); this.HostList.CollectionChanged += (o, e) => { OnPropertyChanged("HostList"); }; View = new VMHostListView(this); }