資源簡介
winform的一個簡單易用異步加載等待效果,調用方式:
this.AsyncWaitDo(delegate{ //異步等待操作}, delegate{//回調操作});
this是要進行異步等待的窗體

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Data;
using?System.Linq;
using?System.Threading;
using?System.Windows.Forms;
namespace?AsyncWaitDoTest
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?toolStripButton1_Click(object?sender?EventArgs?e)
????????{
????????????DataTable?dt?=?null;
????????????this.AsyncWaitDo(delegate
????????????{
????????????????Thread.Sleep(12000);
????????????????Random?rd?=?new?Random();
????????????????DataTable?queryDt?=?new?DataTable();
????????????????queryDt.Columns.Add(“index“?typeof(int));
????????????????queryDt.Columns.Add(“name“?typeof(string));
????????????????for?(int?i?=?0;?i?20;?i++)
????????????????{
????????????????????DataRow?dr?=?queryDt.NewRow();
????????????????????dr[“index“]?=?rd.Next(1?20);
????????????????????dr[“name“]?=?“name“?+?i;
????????????????????queryDt.Rows.Add(dr);
????????????????}
????????????????dt?=?queryDt;
????????????}?delegate
????????????{
????????????????bindingSource1.DataSource?=?dt;
????????????});
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-09-28?16:02??AsyncWaitDoTest\
?????目錄???????????0??2018-09-28?16:01??AsyncWaitDoTest\AsyncWaitDoTest\
?????文件?????????887??2018-09-28?16:03??AsyncWaitDoTest\AsyncWaitDoTest.sln
?????文件???????47104??2018-09-28?16:05??AsyncWaitDoTest\AsyncWaitDoTest.suo
?????文件????????4189??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\AsyncWaitDoTest.csproj
?????目錄???????????0??2018-09-28?13:26??AsyncWaitDoTest\AsyncWaitDoTest\bin\
?????目錄???????????0??2018-09-28?16:03??AsyncWaitDoTest\AsyncWaitDoTest\bin\Debug\
?????文件??????101888??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\bin\Debug\ControlCopyTest.exe
?????文件???????40448??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\bin\Debug\ControlCopyTest.pdb
?????文件???????11600??2018-09-28?16:05??AsyncWaitDoTest\AsyncWaitDoTest\bin\Debug\ControlCopyTest.vshost.exe
?????文件?????????490??2010-03-17?22:39??AsyncWaitDoTest\AsyncWaitDoTest\bin\Debug\ControlCopyTest.vshost.exe.manifest
?????文件?????????198??2018-09-28?14:05??AsyncWaitDoTest\AsyncWaitDoTest\bin\Debug\myFileName.xm
?????目錄???????????0??2018-09-28?13:26??AsyncWaitDoTest\AsyncWaitDoTest\bin\Release\
?????文件????????1178??2018-09-28?16:01??AsyncWaitDoTest\AsyncWaitDoTest\Form1.cs
?????文件???????13204??2018-09-28?16:01??AsyncWaitDoTest\AsyncWaitDoTest\Form1.Designer.cs
?????文件???????10698??2018-09-28?15:59??AsyncWaitDoTest\AsyncWaitDoTest\Form1.resx
?????目錄???????????0??2018-09-26?07:50??AsyncWaitDoTest\AsyncWaitDoTest\obj\
?????目錄???????????0??2018-09-26?07:50??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\
?????目錄???????????0??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\
?????文件???????79519??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\AsyncWaitDoTest.AsyncWaitControl.resources
?????文件????????1260??2018-09-28?16:05??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\AsyncWaitDoTest.csproj.FileListAbsolute.txt
?????文件????????1058??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\AsyncWaitDoTest.csproj.GenerateResource.Cache
?????文件????????3483??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\AsyncWaitDoTest.Form1.resources
?????文件?????????180??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\AsyncWaitDoTest.Properties.Resources.resources
?????文件???????79519??2018-09-28?15:57??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\ControlCopyTest.AsyncWaitControl.resources
?????文件????????1024??2018-09-28?16:01??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\ControlCopyTest.csproj.FileListAbsolute.txt
?????文件????????1058??2018-09-28?16:00??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\ControlCopyTest.csproj.GenerateResource.Cache
?????文件??????101888??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\ControlCopyTest.exe
?????文件????????3483??2018-09-28?16:00??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\ControlCopyTest.Form1.resources
?????文件???????40448??2018-09-28?16:02??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\ControlCopyTest.pdb
?????文件?????????180??2018-09-28?15:57??AsyncWaitDoTest\AsyncWaitDoTest\obj\x86\Debug\ControlCopyTest.Properties.Resources.resources
............此處省略16個文件信息
- 上一篇:倉庫管理系統源碼C#
- 下一篇:c# 斷點上傳
評論
共有 條評論