/// <summary> /// 登录 /// </summary> public void Login() { DataCenter.LoadData(1); Close(); return; int state = DataCenter.Connect(); if (state == -1) { m_mainFrame.ShowMessageBox("无法连接服务器!", "提示", 0); return; } TabControlA tabLogin = GetTabControl("tabLogin"); TabPageA selectedTabpage = tabLogin.SelectedTabPage; TextBoxA txtUserName = GetTextBox("txtUserName"); TextBoxA txtPassword = GetTextBox("txtPassword"); String userName = txtUserName.Text; String passWord = txtPassword.Text; if (userName.Length == 0) { m_mainFrame.ShowMessageBox("请输入邮箱!", "提示", 0); return; } if (userName.IndexOf("@") == -1) { m_mainFrame.ShowMessageBox("邮箱格式不符合要求!", "提示", 0); return; } if (passWord.Length == 0) { m_mainFrame.ShowMessageBox("请输入密码!", "提示", 0); return; } int ret = m_loginService.Login(userName, passWord, m_loginRequestID); if (ret != -1) { UserCookieService cookieService = DataCenter.UserCookieService; UserCookie cookie = new UserCookie(); cookie.m_key = "LOGININFO"; cookie.m_value = userName + "," + passWord; cookieService.AddCookie(cookie); m_window.Enabled = false; } }
/// <summary> /// 调用控件线程方法 /// </summary> /// <param name="args">参数</param> public void OnInvoke(object args) { if (args != null && args.ToString() == "close") { return; } int state = Convert.ToInt32(args); if (state >= 0) { DataCenter.LoadData(state); Close(); } else { m_mainFrame.ShowMessageBox("您输入的用户名或密码错误!", "提示", 0); m_window.Enabled = true; } Native.Invalidate(); }