Home > WPF > Call User Interface (UI) thread from a Asynchronous method

Call User Interface (UI) thread from a Asynchronous method


using System.Window.Threading;

public static class UIThread

{

       public static Dispatcher {get; set;}

      public static void Run(Action a)

      {

             Dispatcher.BeginEnvoke(a);

      }

}

and call it inside a Asynchronous  method like,

public void AsynchronousMethod()

{

      ….

      ….

      UIThread.Run(delegate()

     {

         CustomUIMethod();

     });

}

Advertisements
  1. August 12, 2014 at 9:34 AM

    This post offers clear idea in favor of the new viewers of blogging, that genuinely
    how to do blogging.

    Like

  2. January 1, 2015 at 2:17 PM

    Good info. Lucky me I discovered your site by chance (stumbleupon).
    I’ve saved as a favorite for later!

    Like

  1. No trackbacks yet.

Thanks for your comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: