<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      SmartDispatcher 類

       

       

      UI線程中使用

       

      public class SmartDispatcher
      {
          public static void BeginInvoke(Action action)
          {
              if (Deployment.Current.Dispatcher.CheckAccess() 
                  || DesignerProperties.IsInDesignTool)
              {
                  action();
              }
              else
              {
                  Deployment.Current.Dispatcher.BeginInvoke(action);
              }
          }
      }
       
       
      using System.ComponentModel;
       
      namespace System.Windows.Threading
      {
          /// <summary>
          /// A smart dispatcher system for routing actions to the user interface
          /// thread.
          /// </summary>
          public static class SmartDispatcher
          {
              /// <summary>
              /// A single Dispatcher instance to marshall actions to the user
              /// interface thread.
              /// </summary>
              private static Dispatcher _instance;
       
              /// <summary>
              /// Backing field for a value indicating whether this is a design-time
              /// environment.
              /// </summary>
              private static bool? _designer;
               
              /// <summary>
              /// Requires an instance and attempts to find a Dispatcher if one has
              /// not yet been set.
              /// </summary>
              private static void RequireInstance()
              {
                  if (_designer == null)
                  {
                      _designer = DesignerProperties.IsInDesignTool;
                  }
       
                  // Design-time is more of a no-op, won't be able to resolve the
                  // dispatcher if it isn't already set in these situations.
                  if (_designer == true)
                  {
                      return;
                  }
       
                  // Attempt to use the RootVisual of the plugin to retrieve a
                  // dispatcher instance. This call will only succeed if the current
                  // thread is the UI thread.
                  try
                  {
                      _instance = Application.Current.RootVisual.Dispatcher;
                  }
                  catch (Exception e)
                  {
                      throw new InvalidOperationException("The first time SmartDispatcher is used must be from a user interface thread. Consider having the application call Initialize, with or without an instance.", e);
                  }
       
                  if (_instance == null)
                  {
                      throw new InvalidOperationException("Unable to find a suitable Dispatcher instance.");
                  }
              }
       
              /// <summary>
              /// Initializes the SmartDispatcher system, attempting to use the
              /// RootVisual of the plugin to retrieve a Dispatcher instance.
              /// </summary>
              public static void Initialize()
              {
                  if (_instance == null)
                  {
                      RequireInstance();
                  }
              }
       
              /// <summary>
              /// Initializes the SmartDispatcher system with the dispatcher
              /// instance.
              /// </summary>
              /// <param name="dispatcher">The dispatcher instance.</param>
              public static void Initialize(Dispatcher dispatcher)
              {
                  if (dispatcher == null)
                  {
                      throw new ArgumentNullException("dispatcher");
                  }
       
                  _instance = dispatcher;
       
                  if (_designer == null)
                  {
                      _designer = DesignerProperties.IsInDesignTool;
                  }
              }
       
              /// <summary>
              /// 
              /// </summary>
              /// <returns></returns>
              public static bool CheckAccess()
              {
                  if (_instance == null)
                  {
                      RequireInstance();
                  }
       
                  return _instance.CheckAccess();
              }
       
              /// <summary>
              /// Executes the specified delegate asynchronously on the user interface
              /// thread. If the current thread is the user interface thread, the
              /// dispatcher if not used and the operation happens immediately.
              /// </summary>
              /// <param name="a">A delegate to a method that takes no arguments and 
              /// does not return a value, which is either pushed onto the Dispatcher 
              /// event queue or immediately run, depending on the current thread.</param>
              public static void BeginInvoke(Action a)
              {
                  if (_instance == null)
                  {
                      RequireInstance();
                  }
       
                  // If the current thread is the user interface thread, skip the
                  // dispatcher and directly invoke the Action.
                  if (_instance.CheckAccess() || _designer == true)
                  {
                      a();
                  }
                  else
                  {
                      _instance.BeginInvoke(a);
                  }
              }
          }
      }
      posted @ 2013-12-05 11:22  十一_x  閱讀(367)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国产av寂寞骚妇| 中文字幕av无码不卡| 在线综合亚洲欧洲综合网站| 亚洲三级香港三级久久| 无码国模国产在线观看免费| 日本一区三区高清视频| 中文国产成人精品久久不卡 | 国产一区二区三区不卡在线看| 最新精品国偷自产在线美女足| 人人人澡人人肉久久精品| 亚洲国产精品成人无码区| 国内偷自第一区二区三区| 97人妻人人揉人人躁人人| 麻豆av一区二区三区| 日本高清免费不卡视频| 国产精品亚洲欧美大片在线看| 久久综合久中文字幕青草| 亚洲欧洲日产国无高清码图片| 中文字幕国产精品一区二| 亚洲肥老太bbw中国熟女| 国产av一区二区三区精品| 国产成人精品久久综合| 天天做日日做天天添天天欢公交车| 丰满的少妇被猛烈进入白浆| 亚洲色一色噜一噜噜噜| 亚洲精品无码成人A片九色播放| 日本精品不卡一二三区| 国产精品国语对白一区二区| 中文字字幕在线中文乱码| 亚洲区综合区小说区激情区| 国产在线视频精品视频| av综合亚洲一区二区| 成人白浆一区二区三区在线观看| 精品亚洲欧美高清不卡高清| 国产综合久久99久久| 40岁大乳的熟妇在线观看| 亚洲精品男男一区二区| 久久香蕉国产线看观看怡红院妓院| 蜜臀av一区二区三区精品| 精品国产av一区二区三区| 视频一区二区 国产视频|