public static void NewLineReceived(object sender, CommandEventArgs e) { var message = e.Command.CommandString(); //var message = CmdMessenger.CurrentReceivedLine; WriteLine(IdentSt + "Received > " + Silence(message)); }
public static void NewLineSent(object sender, CommandEventArgs e) { //// Log data to text box var message = e.Command.CommandString(); WriteLine(IdentSt + "Sent > " + Silence(message)); }
void _cmdMessenger_NewLineSent(object sender, CommandEventArgs e) { Debug.WriteLine(String.Format("Sent > {0}",e.Command.CommandString())); }
/// <summary> Helper function to Invoke or directly call event. </summary> /// <param name="newLineHandler"> The event handler. </param> /// <param name="newLineArgs"></param> private void InvokeNewLineEvent(EventHandler<CommandEventArgs> newLineHandler, CommandEventArgs newLineArgs) { if (newLineHandler == null || (ControlToInvokeOn != null && ControlToInvokeOn.IsDisposed)) return; if (ControlToInvokeOn != null) { //Asynchronously call on UI thread ControlToInvokeOn.BeginInvoke((MethodInvoker)(() => newLineHandler(this, newLineArgs))); } else { //Directly call newLineHandler(this, newLineArgs); } }
/// <summary> Helper function to Invoke or directly call event. </summary> /// <param name="newLineHandler"> The event handler. </param> /// <param name="newLineArgs"></param> private void InvokeNewLineEvent(EventHandler<CommandEventArgs> newLineHandler, CommandEventArgs newLineArgs) { if (newLineHandler == null) return; newLineHandler(this, newLineArgs); }
// Log sent line to console private void NewLineSent(object sender, CommandEventArgs e) { Console.WriteLine(@"Sent > " + e.Command.CommandString()); }
// Log received line to console private void NewLineReceived(object sender, CommandEventArgs e) { Console.WriteLine(@"Received > " + e.Command.CommandString()); }
// Log sent line to console private void NewLineSent(object sender, CommandEventArgs e) { _chartForm.LogMessage(@"Sent > " + e.Command.CommandString()); // Console.WriteLine(@"Sent > " + e.Command.CommandString()); }
/// <summary> /// Raised when a new line was send. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> private static void NewLineSent (object sender, CommandEventArgs e) { #if DEBUG Console.WriteLine (DateTime.Now + @": Sent > " + e.Command.CommandString ()); #endif if (OnSendMessage != null) { OnSendMessage.Invoke (null, new CommunicationArgs (e.Command.CommandString ())); } LastCommunication = DateTime.Now; }