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. echarts报错Can't get dom width or height

    echarts图无法显示 一直报错Can't get dom width or height 原因:显示echarts图的div要设置宽高 报错前: <div class="left_ ...

  2. vivado 连接不上板子 There is no current hw_target

    前情提要: vivado连接板子点击auto connect报错 [Labtoolstcl 44-469] There is no current hw_target. 处理步骤: 首先排除硬件问题, ...

  3. JavaScript笔记 #05# 用Regex辅助生成文章目录

    PS. 用来生成个人笔记的目录 1.输入:html文本 <h2>Notes</h2> <p>1.小标题1.正文正文正文</p> <div clas ...

  4. org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within

    org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeo ...

  5. Python调用大漠插件

    Python版本要用32位的?我去官网下载,太慢了,就在腾讯软件里面下载了一个,结果实验成功 import win32com.client dm = win32com.client.Dispatch( ...

  6. 复制MIFARE Classic卡

    Mifare Classic 1K智能卡介绍及nfc-tools的使用 [原创]RFID安全之——ACR122U菜鸟初体验-『智能设备』-看雪安全论坛 复制MIFARE Classic小区门禁卡记录 ...

  7. 使用UI管理docker

    比较全面的对比 wangzi19870227 比较推荐的有两种(http://dockone.io/article/225): Shipyard 和 dockerui https://docs.doc ...

  8. wireshark抓包的过滤规则

    使用wireshark抓包的过滤规则.1.过滤源ip.目的ip.在wireshark的过滤规则框Filter中输入过滤条件.如查找目的地址为192.168.101.8的包,ip.dst==192.16 ...

  9. http 请求头大小写的问题

    如果是默认消息头名称,消息头格式已经固定,即便输入的大小写有误,也会给你翻译成默认的写法,如果自己定义的,会自动给你翻译成小写,所以传参数的名称都用小写字母即可,否则可能取不到值,比如encrypte ...

  10. (4opencv)对OpenCV中“旋转”的思考和实验

    ​    我记得曾经有人对OpenCV的旋转吐槽,意思是它自己没有很好的关于选择的算法.在新的版本里面添加了这些函数(我还没有时间去看是什么时候pr的).现在一个比较棘手的问题,就是OpenCV中旋转 ...