首页 > 代码库 > wpf BackgroundWorker 的简单用法

wpf BackgroundWorker 的简单用法

1. 登陆中。。 登陆成功

            BackgroundWorker worker = new BackgroundWorker();                worker.DoWork += (o, ea) =>                {                                      Login(sName, sPassword);                };                worker.RunWorkerCompleted += (o, ea) =>                {                    if (ea.Error != null)                    {                        tbMsg.Text = ea.Error.Message;                        Password.Clear();                        Password.Focus();                     }                    else                    {                        loginStatus.Text = "登录成功!";                        if ((bool)chkRemember.IsChecked)                        {                            setRememberMe(true, sName, sPassword);                        }                                         }                };                 loginStatus.Text = "正在登录中...";                worker.RunWorkerAsync();

 

wpf BackgroundWorker 的简单用法