Example #1
0
        protected void ExecuteRequest()
        {
            ThreadMethodEntry method = null;

            lock (this.queue)
            {
                if (queue.Count > 0)
                {
                    method = queue.Dequeue();
                }
            }

            if (method != null)
            {
                try
                {
                    if (method.Entry != null)
                    {
                        method.Entry();
                    }
                }
                catch (Exception ex)
                {
                    InvocationException ie = new InvocationException(method.ErrorMessage, ex);
                    Application.OnThreadException(ie);
                }
            }
        }
Example #2
0
        public void BeginInvoke(MethodInvoker method)
        {
            ThreadMethodEntry entry = new ThreadMethodEntry(method);

            queue.Enqueue(entry);
            NativeMethods.PostMessage(handle, NativeMethods.CN_BEGININVOKE, IntPtr.Zero, IntPtr.Zero);
        }
Example #3
0
        public void Invoke(MethodInvoker method, string errorMessage)
        {
            ThreadMethodEntry entry = new ThreadMethodEntry(method, errorMessage);

            queue.Enqueue(entry);
            NativeMethods.SendMessage(new HandleRef(null, handle), NativeMethods.CN_INVOKE, IntPtr.Zero, IntPtr.Zero);
        }