Esempio n. 1
0
        /// <summary>
        /// login
        /// </summary>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = txtUserName.Text.Trim();
            string password = txtPassword.Text.Trim();
            if (userName.IsNullOrWhiteSpace() || password.IsNullOrWhiteSpace())
            {
                this.ShakeForm();
                txtUserName.Text = txtPassword.Text = "";
                txtUserName.Focus();
                SystemSounds.Exclamation.Play();
                return;
            }

            lblShowConnMsg.Visible = pictureBox1.Visible = true;
            userInfo = new UserInfo { Name = userName, Password = password };
            Func<int> myFun = () =>
            {
                // validate input user info
                OperateUserInfo operate = new OperateUserInfo();
                Thread.Sleep(2000);
                return operate.ValidateUserInfo(userInfo);
            };
            myFun.BeginInvoke(CallBackMethod, myFun);
        }