예제 #1
0
        internal void Start(string commandText)
        {
            _command                 = _remoteSystem.Shell.ExecuteCommandAsynchronously(commandText, Timeout.Infinite);
            _command.Finished       += (sender, e) => _callback.OnExit(((NonHostedCommand)sender).ExitCode.ToString());
            _command.OutputReceived += (sender, e) => _callback.OnOutputLine(e.Output);

            _command.RedirectErrorOutputToOutput = true;
            _command.BeginOutputRead();
        }
예제 #2
0
 private void Close()
 {
     lock (_lock)
     {
         if (_command != null)
         {
             _command.Dispose();
             _command = null;
         }
     }
 }
예제 #3
0
        internal void Start(string commandText)
        {
            if (!_remoteSystem.IsConnected)
            {
                _remoteSystem.Connect(_remoteSystem.ConnectionInfo);
            }

            if (_remoteSystem.IsConnected)
            {
                _command                 = _remoteSystem.Shell.ExecuteCommandAsynchronously(commandText, Timeout.Infinite);
                _command.Finished       += (sender, e) => _callback.OnExit(((NonHostedCommand)sender).ExitCode.ToString(CultureInfo.InvariantCulture));
                _command.OutputReceived += (sender, e) => _callback.OnOutputLine(e.Output);

                _command.RedirectErrorOutputToOutput = true;
                _command.BeginOutputRead();
            }
            else
            {
                Debug.Fail("Remote System not connected.");
            }
        }