schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using DataEntity.Share;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using XCommon;
using XImagingXhandler.XDAL;
 
namespace XHandler
{
    /// <summary>
    /// MicroBioLoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MicroBioLoginWindow : Window
    {
        public MicroBioLoginWindow()
        {
            InitializeComponent();
        }
 
        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
 
        private void LoginUser_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!string.IsNullOrEmpty(LoginUser.Text.Trim()))
            {
                LoginUser.BorderThickness = new Thickness(0, 0, 0, 0);
                LoginUserTips.Visibility = Visibility.Collapsed;
            }
        }
 
        private void LoginPassword_PasswordChanged(object sender, RoutedEventArgs e)
        {
            if (LoginPassword.Password.Length <= 0)
            {
                pawdHintText.Text = Properties.Resources.strPassword;
                //okBtn.IsEnabled = false;
            }
            else
            {
                pawdHintText.Text = "";
                LoginPassword.BorderThickness = new Thickness(0, 0, 0, 0);
                LoginPasswordTips.Visibility = Visibility.Collapsed;
            }
        }
 
        private void btnLogin_Click_1(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(LoginUser.Text.Trim()))
            {
                LoginUser.BorderThickness = new Thickness(1, 1, 1, 1);
                LoginUserTips.Content = Properties.Resources.strPlsInputUsername;
                LoginUserTips.Visibility = Visibility.Visible;
                return;
            }
 
            if (string.IsNullOrEmpty(LoginPassword.Password.Trim()))
            {
                LoginPassword.BorderThickness = new Thickness(1, 1, 1, 1);
                LoginPasswordTips.Content = Properties.Resources.strPlsInputPassword;
                LoginPasswordTips.Visibility = Visibility.Visible;
                return;
            }
 
            string user = LoginUser.Text.Trim();
            string pswd = LoginPassword.Password.Trim();
            string md5pswd = ComUtility.GetMD5(pswd);
            bool ok = UserDB.isExistUserByUserInfo(user, md5pswd);
            if (ok)
            {
                Shared.User = UserDB.GetUserInfByUserName(user);
                MainWindow mainWindow = new MainWindow();
                mainWindow.Show();
                this.Close();
            }
        }
 
        private void LoginPassword_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                btnLogin_Click_1(this, null);
            }
        }
 
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // 软件系统名称
            lblSysName.Content = Shared.SoftwareInformation.software_sys_name;
        }
    }
}