WPF实现DoEvents
来源:互联网 发布:淘宝怎么买vr资源 编辑:程序博客网 时间:2024/04/30 17:28
定义WpfApplication类,代码如下(调用方法在需要使用的地方WpfApplication.DoEvents();)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Threading;
namespace PADeleteDat_WPF
{
public class WpfApplication : Application
{
private static DispatcherOperationCallback exitFrameCallback = new
DispatcherOperationCallback(ExitFrame);
/// <summary>
/// Processes all UI messages currently in the message queue.
/// </summary>
public static void DoEvents()
{
// Create new nested message pump.
DispatcherFrame nestedFrame = new DispatcherFrame();
// Dispatch a callback to the current message queue, when getting called,
// this callback will end the nested message loop.
// note that the priority of this callback should be lower than the that of UI event messages.
DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(
DispatcherPriority.Background, exitFrameCallback, nestedFrame);
// pump the nested message loop, the nested message loop will
// immediately process the messages left inside the message queue.
Dispatcher.PushFrame(nestedFrame);
// If the "exitFrame" callback doesn't get finished, Abort it.
if (exitOperation.Status != DispatcherOperationStatus.Completed)
{
exitOperation.Abort();
}
}
private static Object ExitFrame(Object state)
{
DispatcherFrame frame = state as DispatcherFrame;
// Exit the nested message loop.
frame.Continue = false;
return null;
}
}
}
- WPF实现DoEvents
- WPF实现DoEvents
- 用VC实现DoEvents
- DoEvents
- VC++ 实现VB中的DoEvents
- C# 等待框----Application.DoEvents()实现
- C# 等待框----Application.DoEvents()实现
- 实现VB的DoEvents函数(VC++)
- 关于DoEvents
- DoEvents应用
- Application.DoEvents();
- Application.DoEvents()
- Doevents优化
- Doevents用法
- Application.DoEvents
- Application.DoEvents
- Application.DoEvents
- C# DoEvents
- 简单的带动画渐隐效果
- c++ 运算符优先级 来自 c++ primer
- MSRA面经
- PhoneGap与Android之间通信原理
- Java框架介绍:Quartz从入门到进阶
- WPF实现DoEvents
- 获得通讯录中联系人的所有属性
- Java hashCode
- 所用AD芯片的比较
- webstorm
- WPF中的ListBox按块显示元素
- 用 Lucene 加速 Web 搜索应用程序的开发
- RMAN学习2——部分备份(表空间、数据文件)
- iOS开发之详解剪贴板