| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include "../pch/pch.h"
- #include "CChufangSettingWnd.h"
- void CChufangSettingWnd::HandleLogin()
- {
- //判断账号密码是否正确
- std::wstring account, password;
- CEditUI* pAccountEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("accountedit")));
- if (pAccountEdit)
- {
- account = pAccountEdit->GetText().GetData();
- }
- CEditUI* pPasswordEdit = static_cast<CEditUI*>(m_pm.FindControl(_T("pwdedit")));
- if (pPasswordEdit)
- {
- password = pPasswordEdit->GetText().GetData();
- }
- LOG_INFO("account:" << account.c_str() << ", password:" << password.c_str());
- string s_account = CLewaimaiString::UnicodeToUTF8(account);
- string s_password = CLewaimaiString::UnicodeToUTF8(password);
- CZhipuziHttpClient::Init(s_account, s_password);
- std::string errmsg;
- bool res = CZhipuziHttpClient::Login(errmsg);
- if (res)
- {
- CMainWnd* pFrame = new CMainWnd();
- if (pFrame == NULL)
- {
- return;
- }
- pFrame->SetIcon(IDI_ICON_DUILIB);
- pFrame->Create(NULL, _T("游戏中心"), UI_WNDSTYLE_FRAME, 0L, 0, 0, 1024, 738);
- pFrame->CenterWindow();
- ::ShowWindow(*pFrame, SW_SHOWMAXIMIZED);
- Close();
- }
- else
- {
- //登录失败了
- CLabelUI* pLoginResultLabel = static_cast<CLabelUI*>(m_pm.FindControl(_T("loginresult")));
- pLoginResultLabel->SetText(std::wstring(_T("登录失败:") + CLewaimaiString::UTF8ToUnicode(errmsg)).c_str());
- pLoginResultLabel->SetVisible(true);
- }
- }
|