alielie
2026-04-23 ef52fd6fd07508883dce4eb002acda59f0169e59
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using HMI.Core.Entity;
using HMI.UI.Util;
using Panuon.WPF.UI;
using System.ComponentModel;
 
namespace HMI.Base
{
    /// <summary>
    /// RequirePasswordWindow.xaml 的交互逻辑
    /// </summary>
    public partial class RequirePasswordWindow : WindowX
    {
        public RequirePasswordWindow()
        {
            this.DataContext = this;
            InitializeComponent();
        }
 
        private string username;
        public string Username
        {
            get => username;
            set
            {
                Set(ref username, value);
            }
        }
 
        protected override void OnClosing(CancelEventArgs e)
        {
            //Press Continue Button
            if (DialogResult == true)
            {
                if (!string.Equals(PwdPassword.Password, UserInfo.User.Password))
                {
                    ToastHelper.Error(this, "密码错误");
                    e.Cancel = true;
                }
            }
            base.OnClosing(e);
        }
 
        private void WindowX_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            Username = UserInfo.User.Username;
            PwdPassword.Password = string.Empty;
        }
    }
}