private void ShowProgress(CommunicationProgressEventArgs e) { ColorListBoxItem item; item = new ColorListBoxItem(e.Message, communicationLogListBox.BackColor, communicationLogListBox.ForeColor); communicationLogListBox.Items.Insert(0, item); }
private void HandleClientProgress(object sender, CommunicationProgressEventArgs e) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(() => ShowProgress(e))); } else { ShowProgress(e); } }
//method subscribed on agent's progress eventhandler private void HandleAgentServerProgress(object sender, CommunicationProgressEventArgs e) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(() => InsertLogMessage(e))); } else { InsertLogMessage(e); } }
//insert message e into log private void InsertLogMessage(CommunicationProgressEventArgs e) { Monitor.Enter(communicationLogLockObject); Color itemBackColor = communicationLogColorListBox.BackColor; Color ItemForeColor = communicationLogColorListBox.ForeColor; ColorListBoxItem item = new ColorListBoxItem(e.DateTime.ToString(DATETIME_FORMAT) + ": " + e.Message, itemBackColor, ItemForeColor); communicationLogColorListBox.Items.Insert(0, item); Monitor.Exit(communicationLogLockObject); }
private void HandleServerProgress(object sender, CommunicationProgressEventArgs e) { string information = e.DateTime.ToString("yyyyMMdd HHmmss.fff: ") + "[" + e.Action.ToString() + "] " + e.Message; if (InvokeRequired) { this.Invoke(new MethodInvoker(() => messageListBox.Items.Insert(0, information))); } else { messageListBox.Items.Insert(0, information); } }
private void HandleClientProgress(object sender, CommunicationProgressEventArgs e) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(() => ShowProgress(e))); } else { ShowProgress(e); } clientBusy = false; // 20171214 The HandleClientProgress method is executed once a // message has been succesfully sent. }