コード例 #1
0
        private void login_Click(object sender, EventArgs e)
        {
            string user_name = user_test.Text.ToString();
            string password  = password_test.Text.ToString();

            if (string.IsNullOrWhiteSpace(user_name))
            {
                user_name_err.SetError(user_test, "账号不能为空");
                return;
            }

            if (string.IsNullOrWhiteSpace(password))
            {
                user_pwd_err.SetError(password_test, "密码不能为空");
                return;
            }

            if (client != null)
            {
                client.LogOut();
                client = null;
            }
            client = new Client(user_name, password);
        }