System.Windows.Application.Current.Dispatcher.BeginInvoke
System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
if (True)
{
}
}));
异步方法
Task.Factory.StartNew(() =>
{
ViewModel.ToDownload();
});
Task.Factory.StartNew<Update.UpdateConfig>(() =>
{
Thread.Sleep(3000);
bool isnew = Update.UpdateService.CheckNewVersion();
if (isnew)
{
UpdateConfig config=Update.UpdateService.GetNewVersion();
HasChecked = true;
return config;
}
return null;
}, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
.ContinueWith((e) =>
{
if (e.Exception == null)
{
if (e.Result != null)
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
//弹出更新窗口
Update.UpdateService.ShowUpdateWindowLoadComplete(e.Result, () =>
{
return true;
}, Application.Current.MainWindow);
}));
}
}
});
System.Windows.Application.Current.Dispatcher.BeginInvoke的更多相关文章
- WPF 的 Application.Current.Dispatcher 中,为什么 Current 可能为 null
原文:WPF 的 Application.Current.Dispatcher 中,为什么 Current 可能为 null 在 WPF 程序中,可能会存在 Application.Current.D ...
- WPF 的 Application.Current.Dispatcher 中,Dispatcher 属性一定不会为 null
原文:WPF 的 Application.Current.Dispatcher 中,Dispatcher 属性一定不会为 null 在 WPF 程序中,可能会存在 Application.Curren ...
- System.InvalidOperationException: 'Cannot create more than one System.Windows.Application instance in the same AppDomain.'
System.Windows.Application is a singleton: its constructor must only be invoked once (including App. ...
- Wpf Dispatcher.BeginInvoke((Action)delegate{}));
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/w ...
- 开发客户端软件时,出现System.Windows.Markup.XamlParseException错误
开发客户端软件时,出现System.Windows.Markup.XamlParseException错误,通过查看错误消息,发现TCPIP的一个COM组件在安装软件过程中被删除了,重新注册了一下TC ...
- Windows Phone编程中Dispatcher.BeginInvoke的使用
在学习Windows Phone 程序开发时经常会使用到Dispatcher.BeginInvoke()的编程方法,可能许多初学者并不熟悉Dispatcher.BeginInvoke的使用方法以及为什 ...
- 【C#遗补】获取应用程序路径之System.IO.Directory.GetCurrentDirectory和System.Windows.Forms.Application.StartupPath的区别
原文:[C#遗补]获取应用程序路径之System.IO.Directory.GetCurrentDirectory和System.Windows.Forms.Application.StartupPa ...
- 自动化测试 using System.Windows.Automation;
frameworke3.0 及以上 using System.Windows.Automation; UIAutomationClient.dll UIAutomationClientsideProv ...
- Dispatcher.BeginInvoke()方法使用不当导致UI界面卡死的原因分析
原文:Dispatcher.BeginInvoke()方法使用不当导致UI界面卡死的原因分析 前段时间,公司同事开发了一个小工具,在工具执行过程中,UI界面一直处于卡死状态. 通过阅读代码发现,主要是 ...
随机推荐
- Formal Definitions Using ASN.1 - SNMP Tutorial
30.7 Formal Definitions Using ASN.1 The SMI standard specifies that all MIB variables must be define ...
- Python Day10
进程 在python中multiprocess模块提供了Process类,实现进程相关的功能.但是,由于它是基于fork机制的,因此不被windows平台支持.想要在windows中运行,必须使用if ...
- entity-model-first
- java中的equals()方法重写
如何java中默认的equals方法跟实际不符的话,需要重写equals方法.例如: public class TestEquals { public static void main(String[ ...
- tomcat共享lib里面的jar包
参考:http://shitouququ.blog.51cto.com/24569/1255094 1.在tomcat根目录下新建shared/lib目录结构,将项目的jar包放在此目录下,记得将项目 ...
- nyoj 218 Dinner(贪心专题)
Dinner 时间限制:100 ms | 内存限制:65535 KB 难度:1 描述 Little A is one member of ACM team. He had just won t ...
- 【bzoj3036】绿豆蛙的归宿
题目描述 随着新版百度空间的下线,Blog宠物绿豆蛙完成了它的使命,去寻找它新的归宿. 给出一个有向无环的连通图,起点为1终点为N,每条边都有一个长度.绿豆蛙从起点出发,走向终点.到达每一个顶点时,如 ...
- BZOJ2006——[NOI2010]超级钢琴
1.题意:给一个序列,让你取出k个不同的区间,要求长度在之间,问所有区间和的最大值 2.分析:这道题拿过来就能知道是要拿出前k个最大的区间,我们思考最暴力的做法,就是把这个所有的区间枚举出来算,取出前 ...
- Hibernate一对一、一对多、多对多注解映射配置
一对一: 一对多: 多对多:
- [Linux][PHP]安装swoole扩展
1.下载swoole 2.解压并配置 /usr/local/php/bin/phpize ./configure --enable-swoole-debug --enable-sockets --en ...