private void DelStopServer() { APIServerWrapper.StopServer(); APIServerModel old = _serverData.FirstOrDefault(); _serverData = new ObservableCollection <APIServerModel>(); _serverData.Add(new APIServerModel("INITIALIZED", old.ServerIP, old.ServerPort)); OnPropertyChanged("ServerData"); }
private void DelRestartTarget() { if (_selectedClient == null) { MessageBox.Show("Erreur: A client must be selected."); return; } ResponseDLL response = APIServerWrapper.RestartTarget(_selectedClient.ClientID); AddNewLog("RESTART", response); }
private void DelDiagnoseClient() { if (_selectedClient == null) { MessageBox.Show("Erreur: A client must be selected."); return; } ResponseDLL response = APIServerWrapper.DiagClient(_selectedClient.ClientID); AddNewLog("DIAG", response); }
private void DelEchoClient() { if (_selectedClient == null) { MessageBox.Show("Erreur: A client must be selected."); return; } ResponseDLL response = APIServerWrapper.EchoClient(_selectedClient.ClientID); AddNewLog("IS ALIVE", response); }
private void DelSendCommandClient() { if (_selectedClient == null) { MessageBox.Show("Erreur: A client must be selected."); return; } ResponseDLL response = APIServerWrapper.SendCommand(_selectedClient.ClientID, _currentCommand); AddNewLog(String.Format("COMMAND {0}", _currentCommand), response); }
private void DelStopClient() { if (_selectedClient == null) { MessageBox.Show("Erreur: A client must be selected."); return; } ResponseDLL response = APIServerWrapper.StopClient(_selectedClient.ClientID); AddNewLog("STOP CLIENT", response); _clientsList.Remove(_selectedClient); _selectedClient = null; OnPropertyChanged("ClientsList"); }
public APIServerVM(IMessageDialogService dialogService, IFileDialogService fileDialogService) // injects services { _messageDialogService = dialogService; _fileDialogService = fileDialogService; _connectionAccepted = new Callback(ConnectionAccepted); _server = new APIServerWrapper(_connectionAccepted); _startServer = new DelegateCommand(OnStartServer, CanStartServer); _stopServer = new DelegateCommand(OnStopServer, CanStopServer); _sendCommandClient = new DelegateCommand(OnSendCommandClient, IsClientSelected); _sendTypeA = new DelegateCommand(OnSendTypeA, IsClientSelected); _sendTypeB = new DelegateCommand(OnSendTypeB, IsClientSelected); _sendTypeF = new DelegateCommand(OnSendTypeF, IsClientSelected); _echoClient = new DelegateCommand(OnEchoClient, IsClientSelected); _diagnoseClient = new DelegateCommand(OnDiagnoseClient, IsClientSelected); _restartTarget = new DelegateCommand(OnRestartTarget, IsClientSelected); _stopClient = new DelegateCommand(OnStopClient, IsClientSelected); _coldReset = new DelegateCommand(OnColdReset, IsClientSelected); _warmReset = new DelegateCommand(OnWarmReset, IsClientSelected); _powerOFFField = new DelegateCommand(OnPowerOFFField, IsClientSelected); _powerONField = new DelegateCommand(OnPowerONField, IsClientSelected); _clearLogs = new DelegateCommand(OnClearLogs, null); _browseFile = new DelegateCommand(OnBrowseFile, IsClientSelected); _sendCommandsBatch = new AsyncDelegateCommand(async() => await OnSendCommandBatch(), CanSendCommandBatch); _sendCommandsBatchRandom = new AsyncDelegateCommand(async() => await OnSendCommandBatchRandom(), CanSendCommandBatch); //_getVersion = new DelegateCommand(); _actions.AddAction(ActionMethod.COMMAND.ToString(), OnSendCommandClient); _actions.AddAction(ActionMethod.SEND_TYPE_A.ToString(), OnSendTypeA); _actions.AddAction(ActionMethod.SEND_TYPE_B.ToString(), OnSendTypeB); _actions.AddAction(ActionMethod.SEND_TYPE_F.ToString(), OnSendTypeF); _actions.AddAction(ActionMethod.ECHO.ToString(), OnEchoClient); _actions.AddAction(ActionMethod.DIAG.ToString(), OnDiagnoseClient); _actions.AddAction(ActionMethod.RESTART.ToString(), OnRestartTarget); _actions.AddAction(ActionMethod.STOP_CLIENT.ToString(), OnStopClient); _actions.AddAction(ActionMethod.COLD_RESET.ToString(), OnColdReset); _actions.AddAction(ActionMethod.WARM_RESET.ToString(), OnWarmReset); _actions.AddAction(ActionMethod.POWER_OFF_FIELD.ToString(), OnPowerOFFField); _actions.AddAction(ActionMethod.POWER_ON_FIELD.ToString(), OnPowerONField); LoadServerData(); APIServerWrapper.InitServer(); }
public APIServerVM() { _connectionAccepted = new Callback(ConnectionAccepted); _server = new APIServerWrapper(_connectionAccepted); APIServerWrapper.InitServer(); }