Ejemplo n.º 1
0
        private void DelStopServer()
        {
            APIServerWrapper.StopServer();
            APIServerModel old = _serverData.FirstOrDefault();

            _serverData = new ObservableCollection <APIServerModel>();
            _serverData.Add(new APIServerModel("INITIALIZED", old.ServerIP, old.ServerPort));
            OnPropertyChanged("ServerData");
        }
Ejemplo n.º 2
0
        private void DelRestartTarget()
        {
            if (_selectedClient == null)
            {
                MessageBox.Show("Erreur: A client must be selected.");
                return;
            }
            ResponseDLL response = APIServerWrapper.RestartTarget(_selectedClient.ClientID);

            AddNewLog("RESTART", response);
        }
Ejemplo n.º 3
0
        private void DelDiagnoseClient()
        {
            if (_selectedClient == null)
            {
                MessageBox.Show("Erreur: A client must be selected.");
                return;
            }
            ResponseDLL response = APIServerWrapper.DiagClient(_selectedClient.ClientID);

            AddNewLog("DIAG", response);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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");
        }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
0
 public APIServerVM()
 {
     _connectionAccepted = new Callback(ConnectionAccepted);
     _server             = new APIServerWrapper(_connectionAccepted);
     APIServerWrapper.InitServer();
 }