This commit is contained in:
wxt
2026-01-27 13:39:10 +08:00
parent b7167ab67c
commit 3e2f90dfbe
5 changed files with 205 additions and 130 deletions

View File

@@ -64,31 +64,34 @@ namespace 全自动水压检测仪
}
catch (Exception ex)
{
MessageBox.Show($"数据库初始化失败:{ex.Message}\n\n请检查\n1. MySQL服务是否启动\n2. 数据库连接配置是否正确\n3. 数据库 fullautowaterpressure 是否存在\n\n应用程序将退出。",
MessageBox.Show($"数据库初始化失败:{ex.Message}\n\n请检查\n1. MySQL服务是否启动\n2. 数据库连接配置是否正确\n3. 数据库 fullautowaterpressure 是否存在\n\n应用程序将退出。",
"初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
// 显示登录窗体
using (var loginForm = new LoginForm())
{
if (loginForm.ShowDialog() == DialogResult.OK)
// 显示登录窗体
using (var loginForm = new LoginForm())
{
// 登录成功,根据用户权限显示对应窗体
if (LoginData.IsAdmin())
if (loginForm.ShowDialog() == DialogResult.OK)
{
// 管理员登录,显示 ScanImport 页面
Application.Run(new ScanImport());
}
else
{
// 普通用户登录,显示 NormalTemperatureMode 页面
Application.Run(new NormalTemperatureMode());
// 登录成功,根据用户权限显示对应窗体
if (LoginData.IsAdmin())
{
// 管理员登录,显示 ScanImport 页面
Application.Run(new ScanImport());
}
else
{
// 普通用户登录,显示 NormalTemperatureMode 页面
Application.Run(new NormalTemperatureMode());
}
}
// 登录失败或取消,直接退出
}
// 登录失败或取消,直接退出
}
}
/// <summary>
/// 检查并修复损坏的密码数据