Ejemplo n.º 1
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.º 2
0
 public APIServerVM()
 {
     _connectionAccepted = new Callback(ConnectionAccepted);
     _server             = new APIServerWrapper(_connectionAccepted);
     APIServerWrapper.InitServer();
 }