Example #1
0
        private void TryWork(PumpMessage work)
        {
            try
            {
                work.Execute();
            }
            catch (Exception ex)
            {
                PumpExceptionArgs exceptionArgs = new PumpExceptionArgs(ex);
                PumpException.Fire(exceptionArgs);

                if (exceptionArgs.Handled == false)
                {
                    if (ex.InnerException != null)
                    {
                        ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
                    }
                    else
                    {
                        ExceptionDispatchInfo.Capture(ex).Throw();
                    }
                }
            }
#if PROFILING
            CliProfiler.Instance.TotalMessagesProcessed++;
#endif
        }
Example #2
0
        private void TryWork(PumpMessage work)
        {
            try
            {
                work.Execute();
                if (work.Deferred != null)
                {
                    work.Deferred.Resolve();
                }
            }
            catch (Exception ex)
            {
                work.Deferred?.Reject(ex);
                PumpExceptionArgs exceptionArgs = new PumpExceptionArgs(ex);
                PumpException.Fire(exceptionArgs);

                if (exceptionArgs.Handled == false)
                {
                    if (ex.InnerException != null)
                    {
                        ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
                    }
                    else
                    {
                        ExceptionDispatchInfo.Capture(ex).Throw();
                    }
                }
            }
        }
Example #3
0
 protected void QueueActionInFront(PumpMessage pumpMessage)
 {
     lock (pumpMessageQueue)
     {
         pumpMessageQueue.Insert(0, pumpMessage);
     }
 }
Example #4
0
 /// <summary>
 /// Queues the given message for processing on the pump thread
 /// </summary>
 /// <param name="pumpMessage">the message that will be processed in order on the pump thread</param>
 protected void QueueAction(PumpMessage pumpMessage)
 {
     lock (pumpMessageQueue)
     {
         pumpMessageQueue.Add(pumpMessage);
     }
 }
Example #5
0
        /// <summary>
        /// Puts the given action into the work queue, but skips it to the front of the queue
        /// </summary>
        /// <param name="a">the action code to run</param>
        /// <returns>a promise that will resolve when the work is done</returns>
        protected Promise QueueActionInFront(Action a)
        {
            var d           = Deferred.Create();
            var pumpMessage = new PumpMessage(a)
            {
                Deferred = d
            };

            QueueActionInFront(pumpMessage);
            return(d.Promise);
        }
Example #6
0
        /// <summary>
        /// Queues the given action for processing on the pump thread
        /// </summary>
        /// <param name="a">the action that will be processed in order on the pump thread</param>
        public Promise QueueAction(Action a)
        {
            var d           = Deferred.Create();
            var pumpMessage = new PumpMessage(a)
            {
                Deferred = d
            };

            QueueAction(pumpMessage);
            return(d.Promise);
        }
Example #7
0
        /// <summary>
        /// Queues the given message for processing on the pump thread
        /// </summary>
        /// <param name="pumpMessage">the message that will be processed in order on the pump thread</param>
        public void QueueAction(PumpMessage pumpMessage)
        {
            lock (pumpMessageQueue)
            {
                pumpMessageQueue.Add(pumpMessage);
#if PROFILING
                CliProfiler.Instance.TotalMessagesQueued++;
                if (pumpMessage is PaintMessage)
                {
                    CliProfiler.Instance.PaintMessagesQueued++;
                }
#endif
            }
        }
Example #8
0
        private void TryWork(PumpMessage work)
        {
            try
            {
                work.Execute();
            }
            catch (Exception ex)
            {
                PumpExceptionArgs exceptionArgs = new PumpExceptionArgs(ex);
                PumpException.Fire(exceptionArgs);

                if (exceptionArgs.Handled == false)
                {
                    throw;
                }
            }
#if PROFILING
            CliProfiler.Instance.TotalMessagesProcessed++;
#endif
        }
Example #9
0
        protected void QueueActionInFront(Action a)
        {
            var pumpMessage = new PumpMessage(a);

            QueueActionInFront(pumpMessage);
        }
Example #10
0
        /// <summary>
        /// Queues the given action for processing on the pump thread
        /// </summary>
        /// <param name="a">the action that will be processed in order on the pump thread</param>
        public void QueueAction(Action a)
        {
            var pumpMessage = new PumpMessage(a);

            QueueAction(pumpMessage);
        }