关于Winform多线程方式登录代码
来源:才华咖 本文已影响2.62W人
来源:才华咖 本文已影响2.62W人
为了方便大家学习相关的知识,YJBYS小编下面为你整理了关于Winform多线程方式登录代码,希望对你有所帮助。
bool restart = true;
while (restart)
{
Start(out restart);
}
(1):在主进程中不停的调用start.
void Start(out bool restart)
{
bool connected = false;
restart = false;
string[] userInfo = null;
try
{
//打开LoginInfoForm窗体,返回用户名密码。
userInfo = GetLoginInfo();// oginInfo();
if (userInfo == null)
{
loginOK = false;
return;
}
//启动登陆后台线程。LoginProcessForm窗体启动MySplashThread启动不停的打开LoginProcessForm窗体。
();
}
catch (Exception err)
{
e(err);
Dialog("录入登录信息发生异常,请和管理员联系", r);
return;
}
eProcessState previousStepResult = lete;
while (tExecute())
{
try
{
switch (entStep)
{
case eLoginState.__:
case eLoginState.__:
case eLoginState.__:
case eLoginState.__:
}
previousStepResult = lete;
//结束执行
xecute(previousStepResult);
}
catch (Exception error)
{
//略
}
}
}
//start中的对过程的控制。
static public void Show()
{
try
{
//当第二次调用的时候MySplashThread != null了这个时候
if (MySplashThread != null)
{
// public void Reset()
//{
// t();
//currentItemIndex = 0;
//}
//相当于触发t事件。
ke(new MethodInvoker(t));
//将窗体显示出来。
ke(new MethodInvoker());
return;
}
//当第一次的时候调用构造函数构造出窗体。构造出来以后();通知
if (MySplashForm == null)
{
MySplashForm = new LoginProcessForm(myResetEvent);
}
//这里只是每次都调用(MySplashForm);作用相当于建立起信息循环队列
MySplashThread = new Thread(new ThreadStart(Thread));
ckground = true;
partmentState();
t();
//等待直到();
One(5000);
}
catch (Exception err)
{
e(err);
}
}
//构造函数。
public LoginProcessForm(AutoResetEvent autoreset)
{
myResetEvent = autoreset;
Renderer = new SkinFormLoginFormRender();
InitializeComponent();
//ost = true;
//eBox = true;
CanMoveWindow = false;
= "Version:" + mblyFileVersion;
+= new EventHandler(LoginProcessForm_Load);
}
delegate void EndExecuteCallback(eProcessState previousProcessResult);
static public void EndExecute(eProcessState previousProcessResult)
{
//winform中子线程不能更新主线程的`控件。所以keRequired代表是否需要更新主线程控件。
//如果需要更新的话ke
if (keRequired)
{
//回调会继续执行previousProcessResult,等下次的时候就会到下面去执行了。
ke(new EndExecuteCallback(EndExecute), previousProcessResult);
}
else
{
//如果
xecute(previousProcessResult);
}
}
///
/// 进入下一过程
///
///
///
public void EndExecute(eProcessState previousProcessResult)
{
//progressView为我们使用的用户控件
ip(processItems[currentItemIndex], previousProcessResult);
currentItemIndex++;
}
//关闭代码
static public void Close()
{
try
{
if (MySplashThread == null) return;
if (MySplashForm == null) return;
try
{
ke(new MethodInvoker(e));
}
catch (Exception err)
{
e(err);
}
t();
}
catch (Exception err)
{
e(err);
}
finally
{
MySplashThread = null;
MySplashForm = null;
}
}
朗文双语口语教程Form morning to night从早到晚
AndroidApp中使用SurfaceView制作多线程动画的实例讲解
Wonderful life in winter holiday作文(精选14篇)
Linux Mint Cinnamon下使用vino-server配置桌面共享的方法
Unit10《Tomorrow will be rainy》课后复习
My experience with foreign coins初中英文作文
brought rain in April Mayflowe英语作文
Office办公Word多栏页码设置技巧
should women work after getting married英语作文
高中英语作文:Wonderful life in winter holiday
OFFICE2007每次打开word时都显示配置microsoft office professio
英语演讲稿:Working for a short time
英语作文My Experience With Foreign Coins
My Wonderful Winter Holiday Life英语作文
The Impact of Information Explosion高中英语作文
解决PHP中的Cannot modify header information 问题
Woman in Modern Society优秀英语作文
关于直线的两点式方程教学设计
关于Winform多线程方式登录代码
论melogin.cn路由器如何设置登录密码
六年级英语上册Unit2 New York is in the east of America说课稿
李嘉诚语录:成功没有必然方程式
Different art forms in China英语作文
I Can’t Wait For Summer to Come英语作文
A Story Of My Friend Who Ecel大学英语作文
英语作文:Women in the Modern World
计算机一级MSOffice练习题及答案(PowerPoint)2017
Women in the Modern World英语六级作文
Modern Technology Makes Life More Conv英语六级作文
Fancy the original or movie ones大学英语作文
school information英语作文
The Role of Migrant Workers英语作文
英语作文:Importance of Teamwork 团队重要性
Efforts Urged to Improve Womens Reproductive Health英语阅读
英语美文阅读:TheWisdomofOneWord
When is a room not a room大学英语作文
9月计算机一级MsOffice练习:PowerPoint2003
四级英语作文Women in the Modern World
Similar or different friends英语六级作文
代码中心关于代码数据专项清整工作总结