private bool CheckError(ResponseDLL packet) { bool hasError = false; string description = "none"; if (packet.err_server_code != 0) { description = packet.err_server_description; hasError = true; } else if (packet.err_client_code != 0) { description = packet.err_client_description; hasError = true; } else if (packet.err_terminal_code != 0) { description = packet.err_terminal_description; hasError = true; } else if (packet.err_card_code != 0) { description = packet.err_card_description; hasError = true; } if (hasError) { MessageBox.Show("Error: " + description); } return(hasError); }
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 AddNewLog(string request, ResponseDLL response) { if (_logsList.Count == logsLimit) { _logsList[logsPointer] = new LogModel(_selectedClient.ClientID, _selectedClient.ClientName, request, response); } else { _logsList.Add(new LogModel(_selectedClient.ClientID, _selectedClient.ClientName, request, response)); } logsPointer = (logsPointer + 1) % logsLimit; }
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"); }