Files
EzUI/demo/Adminstor/Adminstor/loginForm.cpp
2026-01-26 18:36:55 +08:00

58 lines
1.4 KiB
C++

#include "pch.h"
#include "loginForm.h"
#include "mainForm.h"
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()) {
::MessageBoxW(Hwnd(), L"请阅读协议并勾选!", L"提示", MB_OK);
return;
}*/
UIString user = editUser->GetText();
UIString pwd = editpwd->GetText();
Hide(); // 隐藏登录窗口
static mainForm mainForm;
mainForm.Show(); // 显示主界面
//if (user == "ad" && pwd == "123") {
// ::MessageBoxW(Hwnd(), L"登录成功!", L"提示", MB_OK);
// Hide(); // 隐藏登录窗口
// static mainForm mainForm;
// mainForm.Show(); // 显示主界面
//}
//else {
// ::MessageBoxW(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& close)
{
Application::Exit();
}
loginForm::loginForm() :LayeredWindow(320, 448)
{
umg.LoadXml("res/loginForm.htm");//加载xml里面的控件与样式
umg.SetupUI(this);
}
loginForm::~loginForm()
{
}