// Log sent line to console private void NewLineSent(object sender, NewLineEvent.NewLineArgs e) { Console.WriteLine(@"Sent > " + e.Command.CommandString()); }
// Log received line to console private void NewLineReceived(object sender, NewLineEvent.NewLineArgs e) { Console.WriteLine(@"Received > " + e.Command.CommandString()); }
public static void NewLineSent(object sender, NewLineEvent.NewLineArgs e) { //// Log data to text box var message = e.Command.CommandString(); WriteLine(IdentSt + "Sent > " + Silence(message)); }
/// <summary> Helper function to Invoke or directly call event. </summary> /// <param name="newLineHandler"> The event handler. </param> /// <param name="newLineArgs"></param> private void InvokeNewLineEvent(NewLineEvent.NewLineHandler newLineHandler, NewLineEvent.NewLineArgs newLineArgs) { try { if (newLineHandler == null) return; if (_controlToInvokeOn != null && _controlToInvokeOn.InvokeRequired) { //Asynchronously call on UI thread _controlToInvokeOn.Invoke((MethodInvoker)(() => newLineHandler(this, newLineArgs))); } else { //Directly call newLineHandler(this, newLineArgs); } } catch (Exception) { } }
public static void NewLineReceived(object sender, NewLineEvent.NewLineArgs e) { var message = e.Command.CommandString(); //var message = CmdMessenger.CurrentReceivedLine; WriteLine(IdentSt + "Received > " + Silence(message)); }