Exemplo n.º 1
0
        public void BeginInvoke(WaitCallback method, string errorMessage)
        {
            InvokeObjectHandler entry = new InvokeObjectHandler(method, errorMessage);

            queue.Enqueue(entry);
            NativeMethods.PostMessage(handle, NativeMethods.CN_BEGININVOKE, IntPtr.Zero, IntPtr.Zero);
        }
Exemplo n.º 2
0
        public void Invoke(WaitCallback method, object parameter)
        {
            InvokeObjectHandler entry = new InvokeObjectHandler(method, parameter);

            queue.Enqueue(entry);
            NativeMethods.SendMessage(handle, NativeMethods.CN_INVOKE, IntPtr.Zero, IntPtr.Zero);
        }
Exemplo n.º 3
0
        public void ExecuteRequest()
        {
            InvokeObjectHandler method = null;

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

            if (method != null)
            {
                try
                {
                    if (method.Entry != null)
                    {
                        method.Entry(method.Parameter);
                    }
                }
                catch (Exception ex)
                {
                    InvocationException ie = new InvocationException(method.ErrorMessage, ex);
                    Application.OnThreadException(ie);
                }
            }
        }