/// <summary> /// This function is called in the context of the UI-thread when another thread calls the InvokeUI method. /// </summary> /// <param name="uiCall">This object represents the call.</param> private void UiInvoked(SynchronUiCall uiCall) { if (RCThread.CurrentThread != MainForm.UiThread) { throw new Exception("This call is only allowed from the UI-thread!"); } uiCall.Execute(); }
/// <see cref="IUiInvoke.InvokeUI"/> public void InvokeUI(SynchronUiCall uiCall) { if (RCThread.CurrentThread == MainForm.UiThread) { throw new Exception("This call is not allowed from the UI-thread!"); } this.BeginInvoke(new UiInvokedCallback(this.UiInvoked), new object[1] { uiCall }); uiCall.Wait(); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { SynchronUiCall.TurnOffBlocking(); if (this.hostThread != null || this.guestThread != null) { this.ctrlStatusMgr.Status = FormStatus.Waiting; this.ctrlStatusMgr.UpdateControls(); this.dssThread.ActionQueue.PostAction(UiActionType.LeaveBtnPressed, -1, -1); this.dssThread.Join(); this.hostThread = null; this.guestThread = null; this.dssThread = null; } this.network.ShutdownNetwork(); }