dispatcherObject.CheckAccess

        /// <summary>
        /// The dispatcher object.
        /// </summary>
        private readonly DispatcherObject _dispatcherObject;


       #region Constructor
        public [Constructor]()
        {
            _dispatcherObject = Application.Current;
        }
        #endregion

 void [XXXFunction]()
        {
            if (!_dispatcherObject.CheckAccess())
            {
                _dispatcherObject.Dispatcher.Invoke(new Action(XXXFunction));
                return;

  //maybe all main thread.
            }

posted @ 2013-06-04 08:42  xiaokang088  阅读(256)  评论(0编辑  收藏  举报