Example #1
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);
            }
        }
Example #2
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);
              }
        }