|
|
@@ -81,11 +81,6 @@ void CLoginWnd::Notify(TNotifyUI& msg)
|
|
|
{
|
|
|
if(msg.pSender->GetName() == _T("closebtn"))
|
|
|
{
|
|
|
- if (m_is_login_ing)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
PostQuitMessage(0);
|
|
|
return;
|
|
|
}
|
|
|
@@ -305,11 +300,6 @@ LRESULT CLoginWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool&
|
|
|
{
|
|
|
if(uMsg == WM_KEYDOWN)
|
|
|
{
|
|
|
- if (m_is_login_ing)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
if(wParam == VK_RETURN)
|
|
|
{
|
|
|
CEditUI* pEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
|
|
|
@@ -326,8 +316,7 @@ LRESULT CLoginWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool&
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SetFocus(m_hWnd);
|
|
|
- this->StartLogin();
|
|
|
+ this->HandleLogin();
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
@@ -352,6 +341,7 @@ LRESULT CLoginWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool&
|
|
|
else if (uMsg == WM_NEED_UPDATE)
|
|
|
{
|
|
|
//说明需要升级了
|
|
|
+
|
|
|
Update();
|
|
|
|
|
|
return true;
|
|
|
@@ -384,8 +374,6 @@ void CLoginWnd::StartLogin()
|
|
|
|
|
|
void CLoginWnd::HandleLogin()
|
|
|
{
|
|
|
- m_is_login_ing = true;
|
|
|
-
|
|
|
CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
|
|
|
|
|
|
//真正登录前,先检测是否有需要更新
|
|
|
@@ -395,8 +383,6 @@ void CLoginWnd::HandleLogin()
|
|
|
bool ret = CLewaimaiHttpClient::Request("/version/getwindowsversion", params, response);
|
|
|
if (!ret)
|
|
|
{
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
pLoginResultLabel->SetText(std::wstring(_T("网络请求出错")).c_str());
|
|
|
pLoginResultLabel->SetVisible(true);
|
|
|
|
|
|
@@ -410,8 +396,6 @@ void CLoginWnd::HandleLogin()
|
|
|
|
|
|
if (document.HasParseError())
|
|
|
{
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
pLoginResultLabel->SetText(std::wstring(_T("服务器返回数据格式错误")).c_str());
|
|
|
pLoginResultLabel->SetVisible(true);
|
|
|
|
|
|
@@ -423,8 +407,6 @@ void CLoginWnd::HandleLogin()
|
|
|
{
|
|
|
if (!document.HasMember("errcode") || !document.HasMember("errmsg") || !document.HasMember("data"))
|
|
|
{
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
pLoginResultLabel->SetText(std::wstring(_T("服务器返回数据格式错误")).c_str());
|
|
|
pLoginResultLabel->SetVisible(true);
|
|
|
|
|
|
@@ -437,8 +419,6 @@ void CLoginWnd::HandleLogin()
|
|
|
int errcode = v_errcode.GetInt();
|
|
|
if (errcode != 0)
|
|
|
{
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
std::string errmsg = "response failed! message:" + string(document["errmsg"].GetString());
|
|
|
pLoginResultLabel->SetText(CLewaimaiString::UTF8ToUnicode(errmsg).c_str());
|
|
|
pLoginResultLabel->SetVisible(true);
|
|
|
@@ -455,13 +435,11 @@ void CLoginWnd::HandleLogin()
|
|
|
|
|
|
if (newest_version > CSystem::GetVersion())
|
|
|
{
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
//说明有新版本,要更新
|
|
|
PostMessage(WM_NEED_UPDATE);
|
|
|
return;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
//判断账号密码是否正确
|
|
|
std::wstring account, password;
|
|
|
@@ -490,8 +468,6 @@ void CLoginWnd::HandleLogin()
|
|
|
|
|
|
if (s_account.compare("") == 0)
|
|
|
{
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
pLoginResultLabel->SetText(std::wstring(_T("用户名不能为空")).c_str());
|
|
|
pLoginResultLabel->SetVisible(true);
|
|
|
|
|
|
@@ -502,8 +478,6 @@ void CLoginWnd::HandleLogin()
|
|
|
|
|
|
if (s_password.compare("") == 0)
|
|
|
{
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
pLoginResultLabel->SetText(std::wstring(_T("密码不能为空")).c_str());
|
|
|
pLoginResultLabel->SetVisible(true);
|
|
|
|
|
|
@@ -562,21 +536,17 @@ void CLoginWnd::HandleLogin()
|
|
|
|
|
|
PostMessage(WM_LOGIN_SUCCESS);
|
|
|
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//登录失败了
|
|
|
- CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
|
|
|
-
|
|
|
- pLoginResultLabel->SetText(std::wstring(_T("登录失败:") + CLewaimaiString::UTF8ToUnicode(errmsg)).c_str());
|
|
|
+ pLoginResultLabel->SetText(std::wstring(_T("登录失败:") + CLewaimaiString::UTF8ToUnicode(errmsg)).c_str());
|
|
|
pLoginResultLabel->SetVisible(true);
|
|
|
|
|
|
- m_is_login_ing = false;
|
|
|
-
|
|
|
PostMessage(WM_LOGIN_ERROR);
|
|
|
+
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -640,6 +610,5 @@ void CLoginWnd::ShowLoginAgainOut()
|
|
|
pMessagebox->Create(m_hWnd, _T(""), UI_WNDSTYLE_DIALOG, WS_EX_WINDOWEDGE);
|
|
|
pMessagebox->SetIcon(IDI_ICON_DUILIB);
|
|
|
pMessagebox->CenterWindow();
|
|
|
-
|
|
|
UINT ret = pMessagebox->ShowModal();
|
|
|
}
|