public MainViewModel(IDataService dataService) { _dataService = dataService; AppContext.DataSvc = dataService; Messenger.Default.Register <NotificationMessage>(this, AppContext.BlockChangeContextMsg, BlockContext); Messenger.Default.Register <NotificationMessage>(this, AppContext.UnBlockChangeContextMsg, UnBlockContext); MessengerInstance.Register <String>(this, AppContext.BlockUIMsg, BlockUI); MessengerInstance.Register <String>(this, AppContext.UnBlockUIMsg, UnBlockUI); MessengerInstance.Register <EmptyPopUpVM>(this, AppContext.ShowPopUpMsg, ShowPopUp); MessengerInstance.Register <Partition>(this, AppContext.PartitionAddedMsg, PartitionAdded); MessengerInstance.Register <Partition>(this, AppContext.PartitionChangedMsg, PartitionChanged); MessengerInstance.Register <NotificationMessage>(this, AppContext.PartitionRemovedMsg, PartitionRemoved); MessengerInstance.Register <ControlSpace>(this, AppContext.CSRemovedMsg, CSRemoved); MessengerInstance.Register <ControlSpace>(this, AppContext.CSAddedMsg, CSAdded); PopUpVM = new EmptyPopUpVM(); _dataService.GetPartitions((data, error) => { if (error != null) { return; } // Report error here Partitions = data; }); _dataService.GetActiveControlSpaces((data, error) => { if (error != null) { return; } // Report error here ControlSpaces = data; }); PartitionsVM = new PartitionsVM(dataService); ControlSpacesVM = new ControlSpacesVM(dataService); ControlDevicesVM = new ControlDevicesVM(dataService); EventDevicesVM = new EventDevicesVM(dataService); LightElementsVM = new LightElementsVM(dataService); LightZonesVM = new LightZonesVM(dataService); ScenesVM = new ScenesVM(dataService); TabItems.Add(PartitionsVM); TabItems.Add(ControlSpacesVM); TabItems.Add(ControlDevicesVM); TabItems.Add(EventDevicesVM); TabItems.Add(LightElementsVM); TabItems.Add(LightZonesVM); TabItems.Add(ScenesVM); }
private void ShowPopUp(EmptyPopUpVM obj) { PopUpVM = obj; obj.PopUpVisibility = Visibility.Visible; }