123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.ComponentLibrary
- {
- public class WaitForm
- {
- // private delegate object someMethodDelegate(object someArg);
- private LYFZ.ComponentLibrary.FrmLoadHandling fWait;
- // private IAsyncResult ir;
- // someMethodDelegate sd;
- private object someLongTimeMethod(object someArg)
- {
- return someArg;
- }
- public void ShowForm(IWin32Window owner)
- {
- try
- {
- System.Threading.Thread.Sleep(1);
- // System.IO.File.WriteAllText("test.txt", "开始:" + DateTime.Now.ToString("yyyyMMddhhmmssff"));
- fWait = new LYFZ.ComponentLibrary.FrmLoadHandling(false);
- // sd = new someMethodDelegate(someLongTimeMethod);
- // ir = sd.BeginInvoke("等待中...", null, null);
- fWait.StartPosition = FormStartPosition.CenterScreen;
- fWait.Show(owner);
- fWait.Name = "fwit" + DateTime.Now.ToString("yyyyMMddhhmmssff");
- Application.DoEvents();
- // fWait.Dispose();
- }
- catch { }
- }
- public void CloseForm()
- {
- try
- {
- System.Threading.Thread.Sleep(15);
- // System.IO.File.AppendAllText("test.txt", "\r\n close:"+ DateTime.Now.ToString("yyyyMMddhhmmssff"));
- if (fWait != null)
- {
- fWait.Close();
- fWait.Dispose();
-
- // object retValue = sd.EndInvoke(ir);
- // fWait = null;
- // ir = null;
- // sd = null;
- }
- }
- catch { }
- }
- }
- }
|