protected virtual void OnClientException(NotifyWorkerClientExceptionEventArgs args)
        {
            // Raise the event on the Dispatcher thread
            if (Application.Current.Dispatcher.CheckAccess())
            {
                if (args != null)
                {
                    EventHandler<NotifyWorkerClientExceptionEventArgs> handler = ClientException;
                    if (handler != null)
                    {
                        handler(this, args);
                    }
                }

                // Might be null. After postWork, if everything has worked, null 
                //  is called to clear things out.
                LastClientExceptionEventArgs = args;
            }
            else
            {
                Dispatcher.Invoke(
                    DispatcherPriority.Background,
                    new Action<NotifyWorkerClientExceptionEventArgs>(OnClientException),
                    args);
            }
        }
示例#2
0
 private void m_notifyWorker_ClientException(object sender, NotifyWorkerClientExceptionEventArgs e)
 {
     m_textBlockExceptionCount.Text = (m_clientExceptionCount++).ToString();
 }
 private void m_notifyWorker_ClientException(object sender, NotifyWorkerClientExceptionEventArgs e)
 {
     m_textBlockExceptionCount.Text = (m_clientExceptionCount++).ToString();
 }
示例#4
0
        protected virtual void OnClientException(NotifyWorkerClientExceptionEventArgs args)
        {
            // Raise the event on the Dispatcher thread
            if (Application.Current.Dispatcher.CheckAccess())
            {
                if (args != null)
                {
                    EventHandler<NotifyWorkerClientExceptionEventArgs> handler = ClientException;
                    if (handler != null)
                    {
                        handler(this, args);
                    }
                }

                // Might be null. After postWork, if everything has worked, null
                //  is called to clear things out.
                LastClientExceptionEventArgs = args;
            }
            else
            {
                Dispatcher.Invoke(
                    DispatcherPriority.Background,
                    new Action<NotifyWorkerClientExceptionEventArgs>(OnClientException),
                    args);
            }
        }