Exemplo n.º 1
0
        /// <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));
        }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 3
0
        private void HandleOnTimerElapsed(object source)
        {
            try
            {
                if (TimerWakeUpCallback != null)
                {
                    Base.ExecInUI(TimerWakeUpCallback, new object[] { Args });
                }
            }

            catch (Exception ex)
            {
                Logging.LogException(ex);
            }
        }
Exemplo n.º 4
0
 /// <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));
 }