代码清理
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user