zoukankan      html  css  js  c++  java
  • WPF-模拟Application.DoEvents的类

     /// <summary>
        /// 
        /// </summary>
        public static class DispatcherHelper
        {
            /// <summary>
            /// Simulate Application.DoEvents function of <see cref=" System.Windows.Forms.Application"/> class.
            /// </summary>
            [SecurityPermissionAttribute ( SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode )]
            public static void DoEvents ( )
            {
                DispatcherFrame frame = new DispatcherFrame ( );
                Dispatcher.CurrentDispatcher.BeginInvoke ( DispatcherPriority.Background,
                    new DispatcherOperationCallback ( ExitFrames ), frame );

                try
                {
                    Dispatcher.PushFrame ( frame );
                }
                catch ( InvalidOperationException )
                {
                }
            }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="f"></param>
            /// <returns></returns>
            private static object ExitFrames ( object frame )
            {
                ( ( DispatcherFrame ) frame ).Continue = false;

                return null;
            }
        }

  • 相关阅读:
    mysql各个版本下载地址
    hadoop-0.20.2完全分布式集群
    04_Spring中使用Quartz
    03_CronTrigger
    02_SimpleTrigger
    02_ActiveMQ入门
    01_JMS概述
    01_Quartz基础结构
    Java开发高性能网站需要关注的事
    06_Jedis完成MySQL的条件查询案例
  • 原文地址:https://www.cnblogs.com/buzi521/p/WPF.html
Copyright © 2011-2022 走看看