2026-01-26 18:36:55 +08:00
|
|
|
|
#include "loginForm.h"
|
|
|
|
|
|
#include "mainForm.h"
|
2026-01-25 23:46:14 +08:00
|
|
|
|
|
|
|
|
|
|
LoginForm::LoginForm() :LayeredWindow(320, 448)
|
|
|
|
|
|
{
|
|
|
|
|
|
umg.LoadXml("res/loginForm.htm");//加载xml里面的控件与样式
|
|
|
|
|
|
umg.SetupUI(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
void LoginForm::OnNotify(Control* sender, EventArgs& args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (args.EventType == Event::OnMouseDown) {
|
|
|
|
|
|
if (sender->Name == "btnLogin") {
|
|
|
|
|
|
TextBox* editUser = (TextBox*)FindControl("user");
|
|
|
|
|
|
TextBox* editpwd = (TextBox*)FindControl("pwd");
|
|
|
|
|
|
CheckBox* ckbox = (CheckBox*)FindControl("ckbox");
|
|
|
|
|
|
if (!ckbox->GetCheck()) {
|
|
|
|
|
|
::MessageBox(Hwnd(), L"请阅读协议并勾选!", L"提示", MB_OK);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
UIString user = editUser->GetText();
|
|
|
|
|
|
UIString pwd = editpwd->GetText();
|
|
|
|
|
|
if (user == "718987717" && pwd == "123456") {
|
2026-01-26 18:36:55 +08:00
|
|
|
|
// 登录成功,跳转到主界面
|
|
|
|
|
|
Hide(); // 隐藏登录窗口
|
|
|
|
|
|
static MainForm mainForm;
|
|
|
|
|
|
mainForm.Show(); // 显示主界面
|
2026-01-25 23:46:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
::MessageBox(Hwnd(), L"用户名或密码错误!", L"提示", MB_OK);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (sender->Name == "btnExit") {
|
|
|
|
|
|
Application::Exit();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!sender->GetAttribute("url").empty()) {
|
|
|
|
|
|
::ShellExecuteA(0, "open", sender->GetAttribute("url").c_str(), "", "", SW_SHOW);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
__super::OnNotify(sender, args);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LoginForm::OnClose(bool& bClose)
|
|
|
|
|
|
{
|
|
|
|
|
|
//bClose = false;
|
|
|
|
|
|
Application::Exit();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LoginForm::~LoginForm()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|