WaitingFormHelper
using Lba_Ciac;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms; namespace Lbb.Cx.Ciac.Utility
{
public class WaitingFormHelper
{
private Loading waitingForm = null; private Action _method = null; private WaitingFormHelper(Action method, string message)
{
this._method = method;
this.waitingForm = new Loading();
this.waitingForm.Text = message;
this.waitingForm.StartPosition = FormStartPosition.CenterParent;
this.waitingForm.Shown += new EventHandler(this.waitingForm_Shown);
}
public static void ShowWaitingForm(Action method, string message)
{
WaitingFormHelper waitingFormHelper = new WaitingFormHelper(method, message);
waitingFormHelper.waitingForm.ShowDialog();
} private void waitingForm_Shown(object sender, EventArgs e)
{
try
{
this._method.BeginInvoke(new AsyncCallback(this.callBack), null);
}
catch (System.ObjectDisposedException)
{
return;//如果主界面已经退出了,那线程也退出好了。
}
} private void callBack(IAsyncResult ar)
{
if (this.waitingForm != null && !this.waitingForm.IsDisposed)
{
this.waitingForm.Invoke(new Action(delegate
{
this.waitingForm.Close();
}));
}
}
}
}
WaitingFormHelper的更多相关文章
随机推荐
- linux 安装python3 date更新
http://linux.51yip.com/ ntpdate -u ntp.aliyun.com 更新时间 centos 默认是有 python的,是2.7.5的 重启网络的命令 -- sys ...
- 51Nod 1069 Nim游戏 (位运算)
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1069 有N堆石子.A B两个人轮流拿,A先拿.每次只能从一堆 ...
- 常用正则表达式爬取网页信息及HTML分析总结
Python爬取网页信息时,经常使用的正则表达式及方法. 1.获取<tr></tr>标签之间内容 2.获取<a href..></a>超链接之间内容 3 ...
- vue生产环境清除console.log
npm run build 后的生产环境的代码,会有很多开发时留下的console.log(),不可能每个页面不停地删除 在build/webpack.prod.conf.js文件里加上这样一段代码即 ...
- 自学Java第五周的总结
在这周里我在我要自学网上观看视频学习了有关java的基础知识,课程主要介绍JavaSE,这是整个Java体系的基础:课程将由浅入深,并结合案例进行讲解,在那里我将自己已学的知识进行了巩固,并由学习到了 ...
- 注意!list和array是不同的
python中的list是python的内置数据类型,list中的数据类型不必相同的,而array的中的数据类型必须全部相同. numpy中封装的array有很强大的功能,里面存放的都是相同的数据类 ...
- ConvertUtils.register(new DateConverter(null), java.util.Date.class)使用
在我们使用BeanUtils.copyProperties(dest,orig)将一个类的属性赋值给另一个类的时候 如果类中存在 Date类型的转换可能会报"no value specifi ...
- javaweb笔记—04(预编译和泛型)
预编译:ps对象1.ps可进行预编译,占位符传值,性能高于sta的(数据库驱动层有优化)2.比较灵活,数据库将预编译的SQL缓存了,第二次访问,就不用预编译,直接执行.3.较为安全,不会发生SQL注入 ...
- GitHub使用笔记2:github常用操作
1: 绑定ssh keys 2:github新建仓库 echo "# SpringStack" >> README.md git init git add README ...
- Spring Boot 2(一):Spring Boot 2.0新特性
Spring Boot 2(一):Spring Boot 2.0新特性 Spring Boot依赖于Spring,而Spring Cloud又依赖于Spring Boot,因此Spring Boot2 ...