public MultiDestControlViewModel(MultiDestController controller) { this.Controller = controller; _canRecord = this.Controller.ClientApp.Service.CanRecord(); this.HoldCommand = new RelayCommand(p => this.Controller.OnPutOnHold(), p => CanClear()); this.ClearCommand = new RelayCommand(p => OnClear(), p => CanClear()); this.CallGroupCommand = new RelayCommand(p => this.Controller.OnCallGroup(), p => this.Controller.CanConnect()); this.RecordCommand = new RelayCommand(p => this.Controller.OnRecord(), p => CanRecord); this.GroupSelectCommand = new RelayCommand(p => OnGroupSelect(), p => CanChangeGroup()); }
void OnWorkingModeChanged() { CleanUp(); if (_workingMode == eWorkingMode.Alert) { this.Alarm = null; this.Units = new UnitPhoneListViewModel(this);// { ShowTask = true, ShowResult = true }; this.Units.Refesh(); this.Channels = new ChannelListViewModel(this); this.Menu = new AlertMenuViewModel(this); this.Menu.PropertyChanged += Menu_PropertyChanged; var ctrl = new AlertController(this); this.MainController = ctrl; this.Option = new AlertOptionViewModel(ctrl); this.Control = new AlertControlViewModel(ctrl, eTaskType.CTT); this.MainController.PropertyChanged += MainController_PropertyChanged; this.AddLog("Chuyển sang chế độ BĐ CCT-SSCĐ"); } else if (_workingMode == eWorkingMode.TSL_Alert) { this.Alarm = null; this.Units = this.TSLController.Units; this.Units.Refesh(); this.Channels = this.TSLController.Channels; this.Menu = new AlertMenuViewModel(this, Entities.Enums.eAlertMode.Transfer); this.Menu.PropertyChanged += Menu_PropertyChanged; this.MainController = this.TSLController; this.Option = this.TSLController.OptionVM; this.Control = this.TSLController.ControlVM; this.MainController.PropertyChanged += MainController_PropertyChanged; this.AddLog("Chuyển sang chế độ BĐ CCT-SSCĐ - Truyền số liệu"); } else if (_workingMode == eWorkingMode.CCPK_Alert) { this.Alarm = null; this.Units = new UnitPhoneListViewModel(this); this.Units.Refesh(); this.Channels = new ChannelListViewModel(this); this.Menu = new AlertMenuViewModel(this); this.Menu.PropertyChanged += Menu_PropertyChanged; var ctrl = new CCPK_AlertController(this); this.MainController = ctrl; this.Option = new CCPK_AlertOptionViewModel(ctrl); this.Control = new AlertControlViewModel(ctrl, eTaskType.CCPK); this.MainController.PropertyChanged += MainController_PropertyChanged; this.AddLog("Chuyển sang chế độ BĐ CCPK"); } else if (_workingMode == eWorkingMode.MultiDest) { this.Alarm = null; this.Option = null; this.Units = new UnitPhoneListViewModel(this); this.Units.Refesh(); this.Channels = new ChannelListViewModel(this); this.Menu = new MenuViewModel(this); this.Menu.PropertyChanged += Menu_PropertyChanged; var ctrl = new MultiDestController(this); this.MainController = ctrl; this.Control = new MultiDestControlViewModel(ctrl); this.AddLog("Chuyển sang chế độ Liên Lạc Đa Hướng"); } else if (_workingMode == eWorkingMode.Alarm) { this.Option = null; this.Units = null; this.Channels = new ChannelListViewModel(this); this.Menu = new MenuViewModel(this); this.Menu.PropertyChanged += Menu_PropertyChanged; this.Control = null; this.Alarm = new PrivateAlarmViewModel(this); this.MainController = new PrivateAlarmController(this); this.AddLog("Chuyển sang chế độ BH-BĐ Nội Bộ"); } this.RestrictedAreaCodes = this.Service.GetParameterValue(eGlobalParameter.RestrictedAreaCode); this.Menu.IsInConfigMode = false; RefeshUI(); this.Service.UpdateAllStatus(); ShowMessage(string.Empty, string.Empty, false); }