/// <summary> /// Timer Tick to update the current Connection State /// </summary> /// <param name="sender"></param> private void updateStatusBar_Tick(object sender) { // Create a new Event Argument ConnectionStateUpdateEventArgs eventAargument = new ConnectionStateUpdateEventArgs(); /// read the Current State of the Connection if (connectionSettings.functionSelect == 0) { eventAargument.connection1State = singleConnection.getConnectionState(); eventAargument.connection2State = -1;// Hide the Second Communication } else if (connectionSettings.functionSelect == 1) { eventAargument.connection1State = multiConnection.getConnection1State(); eventAargument.connection2State = multiConnection.getConnection2State(); } // Call the Notifiy Function to Raise the Event statusbarUpdate(eventAargument); connectionStateCommuniation1 = eventAargument.connection1State; connectionStateCommuniation2 = eventAargument.connection2State; }
// Invoke the Changed event; called whenever list changes protected virtual void statusbarUpdate(ConnectionStateUpdateEventArgs e) { if (StatusbarUpdate != null) { StatusbarUpdate(this, e); } }
/// <summary> /// Event for the Update of the Eventhandler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void UpdateConnectionState_Event(object sender, ConnectionStateUpdateEventArgs e) { this.Dispatcher.Invoke(DispatcherPriority.Normal, new System.Windows.Threading.DispatcherOperationCallback(delegate { // Update the RichtextBox UpdateStatusBarConnectionState(e.connection1State, e.connection2State); return(null); }), null); }