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的更多相关文章

随机推荐

  1. json.dumps(),json.loads(),json.dump(),json.load()方法的区别

    1. json.dumps() json.dump()是将字典类型转化成字符串类型. import json dic = {'a':'1111','b':'2222','c':'3333','d':' ...

  2. hashcat使用命令简介

    1.指定HASH类型 在HashCat中--hash-type ?参数可以指定要破解的HASH类型,运行hashcat主程序加上--help参数,在* Generic hash types:中可以看到 ...

  3. The Little Prince-12/12

    The Little Prince-12/12 双十二,大家有没有买买买呢?宝宝双十一之后就吃土了,到现在,叶子都长出来了!!! 当你真的喜欢一个人的时候 就会想很多 会很容易办蠢事 说傻话 小王子要 ...

  4. springboot打war包需要注意事项

    1. pom文件 1.1 添加servlet-api依赖: <!-- 添加servlet-api的依赖--> <dependency> <groupId>org.a ...

  5. 控制层和ajax用法的详解

    商城项目第二天复习的内容 package cn.tedu.store.entity; public class ResponseResult<T> { public static fina ...

  6. selenium webdriver 实现Canvas画布自动化测试

    https://blog.csdn.net/xiaoguanyusb/article/details/80324210 由借鉴意义, 转过来 canvas 是一个画布,定位元素时只能定位到画布上,如下 ...

  7. torchvision.datasets.ImageFolder数据加载

    ImageFolder 一个通用的数据加载器,数据集中的数据以以下方式组织 root/dog/xxx.png root/dog/xxy.png root/dog/xxz.png root/cat/12 ...

  8. pyglet self.

    import pyglet class T(pyglet.window.Window): def __init__(self): super(T, self).__init__() self.play ...

  9. django 分页函数

    实现类似: 上一页 1 ... 4 5 7 8 ... 89 下一页 的效果 def pageGenerate(fullList,pagenum,urltype,type,currpage): pag ...

  10. SQL语句的优化方法

    减少对数据库的查询次数 尽量使用相同的或非常类似的SQL语句进行查询 避免不带任何条件的SQL语句的执行 sql语句用大写 别名的使用(1.5倍)