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界面一直处于卡死状态. 通过阅读代码发现,主要是 ...
随机推荐
- [转]eclipse重新编译
Eclipse打开时并不重新生成class文件,这就造成了eclipse找不到需要的class文件从而不能正常编译工程中的其他代码.此时就需要重新编译工程. 单击Project菜单,选择Clean菜单 ...
- apache 多网站日志配置禁止ip访问
#禁止IP访问服务器AcceptFilter http noneAcceptFilter https none<VirtualHost 192.168.1.220>ServerName 1 ...
- ajax 提交表单文件上传
<form action="" method="post" enctype="multipart/form-data" id=&quo ...
- (转)为什么所有浏览器的userAgent都带Mozilla
转自:http://www.eamonning.com/blog/view/289 以下是全文 最早的时候有一个浏览器叫NCSA Mosaic,把自己标称为NCSA_Mosaic/2.0 (Windo ...
- [Unity3d]3D项目转换为VR项目(暴风魔镜SDK)
使用暴风魔镜SDK来操作 将魔镜的摄像头拖放到项目中: 将MoJingVrHead的Script剪切到CamRoot中: 这个时候能看到显示2个物体了,不过使用的Canvas还是显示一个: 调整Can ...
- 程序代码中退出函数exit()与返回函数return ()的区别
程序代码中退出函数exit()与返回函数return ()的区别 exit(0):正常运行程序并退出程序: exit(1):非正常运行导致退出程序: return():返回函数,若在主函数 ...
- IOS热更新-JSPatch实现原理+Patch现场恢复
关于HotfixPatch 在IOS开发领域,由于Apple严格的审核标准和低效率,IOS应用的发版速度极慢,稍微大型的app发版基本上都在一个月以上,所以代码热更新(HotfixPatch)对于IO ...
- Java中的BoneCP数据库连接池用法
http://zhoufoxcn.blog.51cto.com/792419/438277/ C3P0,Proxool,BoneCP,Druid
- 2015安徽省赛 G.你来擒孟获
http://xcacm.hfut.edu.cn/problem.php?id=1211 SPFA模板题目 最短路变种,从起点终点各找一次最短路相加 #include<iostream> ...
- Proj.4库的编译及使用
Proj.4库的编译及使用 Proj.4是开源GIS最著名的地图投影库,GRASS GIS, MapServer, PostGIS, Thuban, OGDI, Mapnik, TopoCad, GD ...