代码清理

This commit is contained in:
2025-03-24 19:24:16 +08:00
parent fb1ae0bb08
commit fabc7606e7
14 changed files with 425 additions and 547 deletions

View File

@ -1,26 +1,23 @@
using AntdUI;
using DHSoftware.Models;
using DHSoftware.Services;
namespace DHSoftware
{
public partial class LoginWindow : AntdUI.Window
{
public LoginWindow()
{
InitializeComponent();
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
/// <summary>
/// 窗体对象实例
/// </summary>
private static LoginWindow _instance;
internal static LoginWindow Instance
{
get
@ -30,6 +27,7 @@ namespace DHSoftware
return _instance;
}
}
private void Button_cancel_Click(object? sender, EventArgs e)
{
this.Dispose();
@ -37,8 +35,8 @@ namespace DHSoftware
private void Button_ok_Click(object? sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(iptName.Text))
{
if (string.IsNullOrWhiteSpace(iptName.Text))
{
AntdUI.Message.warn(this, "用户名不能为空!", autoClose: 3);
return;
}
@ -47,9 +45,8 @@ namespace DHSoftware
AntdUI.Message.warn(this, "密码不能为空!", autoClose: 3);
return;
}
if(AuthService.Login(iptName.Text, iptPwd.Text))
if (AuthService.Login(iptName.Text, iptPwd.Text))
{
if (this.Owner is MainWindow parent)
{
List<string> UserPermissions = AuthService.GetUserPermissions();
@ -87,10 +84,9 @@ namespace DHSoftware
parent.Deleteschememe = false;
}
parent.LoginName=iptName.Text;
parent.LoginName = iptName.Text;
}
this.Dispose();
this.Dispose();
}
else
{
@ -100,7 +96,6 @@ namespace DHSoftware
private void LoginWindow_Load(object sender, EventArgs e)
{
}
}
}
}