/// <summary> /// This method handles the life-cycle management of the thread, as some /// marketing people would put it. /// </summary> private void InternalRun() { Debug.Assert(Status == WorkerStatus.Running); try { Run(); } catch (WorkerCancellationException) { Status = WorkerStatus.Cancelled; } catch (Exception e) { Status = WorkerStatus.Failed; FailException = e; } if (Status == WorkerStatus.Running) { Status = WorkerStatus.Success; } Base.ExecInUI(new Base.EmptyDelegate(InternalOnCompletion)); }
/// <summary> /// Call the HTTP query event handler in UI context. /// </summary> private void FireOnHttpEvent(HttpQueryEventArgs ev) { Base.ExecInUI(new Base.EmptyDelegate(delegate() { if (OnHttpQueryEvent != null) { OnHttpQueryEvent(this, ev); } }), null); }
private void HandleOnTimerElapsed(object source) { try { if (TimerWakeUpCallback != null) { Base.ExecInUI(TimerWakeUpCallback, new object[] { Args }); } } catch (Exception ex) { Logging.LogException(ex); } }
/// <summary> /// Post a message to the UI thread from the context of the worker thread. /// </summary> protected void PostToUI(UiThreadMsg m) { Base.ExecInUI(new Base.EmptyDelegate(m.Run)); }