zoukankan      html  css  js  c++  java
  • WPF 刷新画面

    1 /// <summary>
    2 /// Designates a Windows Presentation Foundation application model with added functionalities.
    3 /// </summary>
    4   public class UIHelper : Application
    5 {
    6 private static DispatcherOperationCallback exitFrameCallback = new DispatcherOperationCallback(ExitFrame);
    7
    8 /// <summary>
    9 /// Processes all UI messages currently in the message queue.
    10 /// </summary>
    11 public static void DoEvents()
    12 {
    13 // Create new nested message pump.
    14 DispatcherFrame nestedFrame = new DispatcherFrame();
    15
    16 // Dispatch a callback to the current message queue, when getting called,
    17 // this callback will end the nested message loop.
    18 // note that the priority of this callback should be lower than the that of UI event messages.
    19 DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(
    20 DispatcherPriority.Background, exitFrameCallback, nestedFrame);
    21
    22 // pump the nested message loop, the nested message loop will
    23 // immediately process the messages left inside the message queue.
    24 Dispatcher.PushFrame(nestedFrame);
    25
    26 // If the "exitFrame" callback doesn't get finished, Abort it.
    27 if (exitOperation.Status != DispatcherOperationStatus.Completed)
    28 {
    29 exitOperation.Abort();
    30 }
    31 }
    32
    33 private static Object ExitFrame(Object state)
    34 {
    35 DispatcherFrame frame = state as DispatcherFrame;
    36 // Exit the nested message loop.
    37 if (frame != null)
    38 {
    39 frame.Continue = false;
    40 }
    41 return null;
    42 }
    43
    44 }

  • 相关阅读:
    str_replace
    [转载][HTML] 普通的DIV分层以及版透明效果
    [PHP] PHP Excel导出 以及编码问题
    [FreeProxy]FreeProxy代理服务器端软件介绍 之 sock 5
    修改MySQL的递增的起始值
    台哥原创:java五子棋源码(人机对弈)
    java游戏开发杂谈
    java游戏开发杂谈
    java游戏开发杂谈
    java游戏开发杂谈
  • 原文地址:https://www.cnblogs.com/hongyu/p/2048949.html
Copyright © 2011-2022 走看看