轮胎外观检测添加思谋语义分割模型检测工具
C3204
2026-04-01 eda17eddf88e6108cadbf8dcef5c2195c1a7b708
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
 
using LB_SmartVisionCommon;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using MessageBox = System.Windows.Forms.MessageBox;
 
namespace LB_SmartVisionLoginUI
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        /// <summary>
        /// 调用Windows的API库user32.dll中的消息发送机制,可实现跨程序数据发送
        /// </summary>
        /// <param name="hwnd"></param>
        /// <param name="wMsg"></param>
        /// <param name="wParam"></param>
        /// <param name="lParam"></param>
        /// <returns></returns>
        [DllImport("user32.dll", EntryPoint = "SendMessageA")]
        public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
        /// <summary>
        /// 当前登录的用户名,也需要共享给整个工程
        /// </summary>
        public static string userName;//
        /// <summary>
        /// 用户密码
        /// </summary>
        private static string userPassword;
        /// <summary>
        /// 是否退出
        /// </summary>
        public bool isQuit = false;
        /// <summary>
        /// 当前用户
        /// </summary>
        public  bool correctUser = false;
        /// <summary>
        /// 是否登出
        /// </summary>
        public bool login_on_off = false;
 
 
        private MainWindow()
        {
            InitializeComponent();
            correctUser = false;
        }
 
        private static MainWindow instanceLoginandConfirmation = null;
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static MainWindow InstanceLoginandConfirmation()
        {
            if (instanceLoginandConfirmation == null)
            {
                instanceLoginandConfirmation = new MainWindow();
            }
            return instanceLoginandConfirmation;
        }
 
        /// <summary>
        /// 关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void test_Close(object sender, MouseButtonEventArgs e)
        {
            correctUser = false;
            isQuit = true;
            this.Close();
        }
 
        /// <summary>
        /// 最小化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void test_Min(object sender, MouseButtonEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }
 
        private void Btn_Cancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            try
            {
                Process[] processes = System.Diagnostics.Process.GetProcesses(); //获得所有进程
                foreach (Process p in processes)
                {
                    if (p.ProcessName == "ShockPadMeasurementSystem" && p.StartTime < DateTime.Now.AddMilliseconds(-300))
                    {
                        p.Kill();
                    }
                }
            }
            catch { }
        }
 
        private void Btn_KeyBoard_Click(object sender, RoutedEventArgs e)
        {
            System.Diagnostics.Process.Start(@"C:\WINDOWS\system32\osk.exe");
        }
 
        private void Btn_Login_Click(object sender, RoutedEventArgs e)
        {
            login_on_off = true;
            loginon();
            // 在此处添加事件处理程序实现。
            if (correctUser)//如果用户名密码正确,合法登录,则获得当前用户名和级别。同时关闭登录窗体
            {
                userName = this.Txt_UserName.Text.Trim().ToLower();
                userPassword = this.Txt_UserPassWord.Password;
                //closeLoginFrm();
                this.Hide();
            }
        }
 
        private void loginon()
        {
            if (!UserManager.Instance.Login(this.Txt_UserName.Text.Trim(), this.Txt_UserPassWord.Password))
            {
                MessageBox.Show("请输入正确的用户名和密码.",
                    "登录失败!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                correctUser = false;
                return;
            }
            else// Valid user, pass the authentication
            {
                userName = this.Txt_UserName.Text.Trim();
                userPassword = this.Txt_UserPassWord.Password;
                correctUser = true;
                isQuit = false;
            }
        }
        /// <summary>
        /// 关闭
        /// </summary>
        public void closeLoginFrm()
        {
            this.ShowInTaskbar = false;//点击登录后去掉任务栏图标
            instanceLoginandConfirmation = null;
            this.Close();
        }
 
        private void Txt_UserPassWord_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key== Key.Enter)
            {
                login_on_off = true;
                loginon();
                // 在此处添加事件处理程序实现。
                if (correctUser)
                {
                    userName = this.Txt_UserName.Text.Trim().ToLower();
                    userPassword = this.Txt_UserPassWord.Password;
                    isQuit = false;
                    //closeLoginFrm();
                }
            }
            else if (e.Key == Key.Escape)
            {
                correctUser = false;
                isQuit = true;
                this.Close();
            }
        }
 
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            this.Txt_UserName.Text = "";
            this.Txt_UserPassWord.Password = "";
        }
    }
}