private void Stream_DataReceived(object sender, EventArgs e) { terminal.BeginChange(); if (DataAvailable != null) { DataAvailable(this, EventArgs.Empty); } terminal.EndChange(); }
private void Stream_DataReceived(object sender, Renci.SshNet.Common.ShellDataEventArgs e) { terminal.BeginChange(); if (DataAvailable != null) { DataAvailable(this, EventArgs.Empty); } else { throw new InvalidOperationException("Data was received but no one was listening."); } terminal.EndChange(); }
private void Stream_DataReceived(object sender, Renci.SshNet.Common.ShellDataEventArgs e) { terminal.BeginChange(); if (DataAvailable != null) { DataAvailable(this, new DataAvailableEventArgs(e.Data.Length)); outputQueue.Enqueue(middle.GetCopy()); outputWait.Set(); } else { throw new InvalidOperationException("Data was received but no one was listening."); } terminal.EndChange(); }
public void Start() { stopped = false; stream.DataReceived += Stream_DataReceived; Task.Run(() => { while (true) { received.Wait(); if (stopped) { break; } while (stream.DataAvailable) { terminal.BeginChange(); if (DataAvailable != null) { bool done = false; Task.Run(() => { while (!done) { Thread.Sleep(50); if (done) { break; } terminal.CycleChange(); } }); DataAvailable(this, new DataAvailableEventArgs(0)); done = true; } else { throw new InvalidOperationException("Data was received but no one was listening."); } terminal.EndChange(); } } }); received.Release(); }