This commit is contained in:
wxt
2026-01-27 13:39:10 +08:00
parent b7167ab67c
commit 3e2f90dfbe
5 changed files with 205 additions and 130 deletions

View File

@@ -33,10 +33,13 @@ namespace 全自动水压检测仪
this.uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel();
this.uiTableLayoutPanel2 = new Sunny.UI.UITableLayoutPanel();
this.panel1 = new System.Windows.Forms.Panel();
this.uiButton9 = new Sunny.UI.UIButton();
this.uiButton4 = new Sunny.UI.UIButton();
this.uiPanel29 = new Sunny.UI.UIPanel();
this.uiTableLayoutPanel15 = new Sunny.UI.UITableLayoutPanel();
this.uiPanel30 = new Sunny.UI.UIPanel();
this.uiLabel25 = new Sunny.UI.UILabel();
this.uiLabel11 = new Sunny.UI.UILabel();
this.uiSwitch1 = new Sunny.UI.UISwitch();
this.uiPanel7 = new Sunny.UI.UIPanel();
this.uiTableLayoutPanel4 = new Sunny.UI.UITableLayoutPanel();
@@ -160,8 +163,6 @@ namespace 全自动水压检测仪
this.uiPanel2 = new Sunny.UI.UIPanel();
this.uiLabel1 = new Sunny.UI.UILabel();
this.uiLight1 = new Sunny.UI.UILight();
this.uiLabel11 = new Sunny.UI.UILabel();
this.uiLabel25 = new Sunny.UI.UILabel();
this.uiTableLayoutPanel1.SuspendLayout();
this.uiTableLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout();
@@ -255,6 +256,7 @@ namespace 全自动水压检测仪
//
// panel1
//
this.panel1.Controls.Add(this.uiButton9);
this.panel1.Controls.Add(this.uiButton4);
this.panel1.Controls.Add(this.uiPanel29);
this.panel1.Controls.Add(this.uiPanel7);
@@ -265,6 +267,22 @@ namespace 全自动水压检测仪
this.panel1.Size = new System.Drawing.Size(188, 598);
this.panel1.TabIndex = 0;
//
// uiButton9
//
this.uiButton9.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiButton9.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(130)))), ((int)(((byte)(240)))));
this.uiButton9.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(150)))), ((int)(((byte)(255)))));
this.uiButton9.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(120)))), ((int)(((byte)(220)))));
this.uiButton9.Font = new System.Drawing.Font("微软雅黑", 14F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton9.Location = new System.Drawing.Point(107, 535);
this.uiButton9.MinimumSize = new System.Drawing.Size(1, 1);
this.uiButton9.Name = "uiButton9";
this.uiButton9.Size = new System.Drawing.Size(75, 55);
this.uiButton9.TabIndex = 4;
this.uiButton9.Text = "退出";
this.uiButton9.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton9.Click += new System.EventHandler(this.uiButton9_Click);
//
// uiButton4
//
this.uiButton4.Cursor = System.Windows.Forms.Cursors.Hand;
@@ -272,10 +290,10 @@ namespace 全自动水压检测仪
this.uiButton4.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(150)))), ((int)(((byte)(255)))));
this.uiButton4.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(120)))), ((int)(((byte)(220)))));
this.uiButton4.Font = new System.Drawing.Font("微软雅黑", 14F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton4.Location = new System.Drawing.Point(46, 534);
this.uiButton4.Location = new System.Drawing.Point(11, 535);
this.uiButton4.MinimumSize = new System.Drawing.Size(1, 1);
this.uiButton4.Name = "uiButton4";
this.uiButton4.Size = new System.Drawing.Size(100, 55);
this.uiButton4.Size = new System.Drawing.Size(88, 55);
this.uiButton4.TabIndex = 3;
this.uiButton4.Text = "水箱加热";
this.uiButton4.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -329,8 +347,30 @@ namespace 全自动水压检测仪
this.uiPanel30.RectColor = System.Drawing.Color.White;
this.uiPanel30.Size = new System.Drawing.Size(154, 47);
this.uiPanel30.TabIndex = 0;
this.uiPanel30.Text = null;
this.uiPanel30.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiLabel25
//
this.uiLabel25.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel25.ForeColor = System.Drawing.Color.Red;
this.uiLabel25.Location = new System.Drawing.Point(2, 0);
this.uiLabel25.Name = "uiLabel25";
this.uiLabel25.Size = new System.Drawing.Size(50, 47);
this.uiLabel25.TabIndex = 1;
this.uiLabel25.Text = "请切换模式";
this.uiLabel25.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiLabel11
//
this.uiLabel11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel11.Location = new System.Drawing.Point(69, -1);
this.uiLabel11.Name = "uiLabel11";
this.uiLabel11.Size = new System.Drawing.Size(86, 47);
this.uiLabel11.TabIndex = 0;
this.uiLabel11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiSwitch1
//
this.uiSwitch1.ActiveColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
@@ -1692,7 +1732,7 @@ namespace 全自动水压检测仪
//
this.uiButton8.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiButton8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton8.Location = new System.Drawing.Point(426, 126);
this.uiButton8.Location = new System.Drawing.Point(426, 122);
this.uiButton8.MinimumSize = new System.Drawing.Size(1, 1);
this.uiButton8.Name = "uiButton8";
this.uiButton8.Size = new System.Drawing.Size(58, 33);
@@ -2138,7 +2178,6 @@ namespace 全自动水压检测仪
this.uiLabel3.Name = "uiLabel3";
this.uiLabel3.Size = new System.Drawing.Size(108, 30);
this.uiLabel3.TabIndex = 1;
this.uiLabel3.Text = "0";
this.uiLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiLabel2
@@ -2199,27 +2238,6 @@ namespace 全自动水压检测仪
this.uiLight1.TabIndex = 1;
this.uiLight1.Text = "uiLight1";
//
// uiLabel11
//
this.uiLabel11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.uiLabel11.Location = new System.Drawing.Point(69, -1);
this.uiLabel11.Name = "uiLabel11";
this.uiLabel11.Size = new System.Drawing.Size(86, 47);
this.uiLabel11.TabIndex = 0;
this.uiLabel11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiLabel25
//
this.uiLabel25.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiLabel25.ForeColor = System.Drawing.Color.Red;
this.uiLabel25.Location = new System.Drawing.Point(2, 0);
this.uiLabel25.Name = "uiLabel25";
this.uiLabel25.Size = new System.Drawing.Size(50, 47);
this.uiLabel25.TabIndex = 1;
this.uiLabel25.Text = "请切换模式";
this.uiLabel25.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// NormalTemperatureMode
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -2425,6 +2443,7 @@ namespace 全自动水压检测仪
private Sunny.UI.UIButton uiButton8;
private Sunny.UI.UILabel uiLabel11;
private Sunny.UI.UILabel uiLabel25;
private Sunny.UI.UIButton uiButton9;
}
}

View File

@@ -1203,5 +1203,23 @@ namespace 全自动水压检测仪
return registers;
}
public event EventHandler ReturnToLoginRequested;
//返回登录
private void uiButton9_Click(object sender, EventArgs e)
{
// 停止所有操作
_readTimer?.Stop();
_readTimerTwo?.Stop();
// 释放资源
ModbusResourceManager.Instance?.Dispose();
// 直接重新启动应用程序
Application.Restart();
// 关闭当前窗口
Environment.Exit(0);
}
}
}

View File

@@ -64,31 +64,34 @@ namespace 全自动水压检测仪
}
catch (Exception ex)
{
MessageBox.Show($"数据库初始化失败:{ex.Message}\n\n请检查\n1. MySQL服务是否启动\n2. 数据库连接配置是否正确\n3. 数据库 fullautowaterpressure 是否存在\n\n应用程序将退出。",
MessageBox.Show($"数据库初始化失败:{ex.Message}\n\n请检查\n1. MySQL服务是否启动\n2. 数据库连接配置是否正确\n3. 数据库 fullautowaterpressure 是否存在\n\n应用程序将退出。",
"初始化错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
// 显示登录窗体
using (var loginForm = new LoginForm())
{
if (loginForm.ShowDialog() == DialogResult.OK)
// 显示登录窗体
using (var loginForm = new LoginForm())
{
// 登录成功,根据用户权限显示对应窗体
if (LoginData.IsAdmin())
if (loginForm.ShowDialog() == DialogResult.OK)
{
// 管理员登录,显示 ScanImport 页面
Application.Run(new ScanImport());
}
else
{
// 普通用户登录,显示 NormalTemperatureMode 页面
Application.Run(new NormalTemperatureMode());
// 登录成功,根据用户权限显示对应窗体
if (LoginData.IsAdmin())
{
// 管理员登录,显示 ScanImport 页面
Application.Run(new ScanImport());
}
else
{
// 普通用户登录,显示 NormalTemperatureMode 页面
Application.Run(new NormalTemperatureMode());
}
}
// 登录失败或取消,直接退出
}
// 登录失败或取消,直接退出
}
}
/// <summary>
/// 检查并修复损坏的密码数据

View File

@@ -35,6 +35,15 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.save = new Sunny.UI.UIButton();
this.uiDataGridView1 = new Sunny.UI.UIDataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SerialNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uiTextBox2 = new Sunny.UI.UITextBox();
this.uiLabel48 = new Sunny.UI.UILabel();
this.uiTextBox9 = new Sunny.UI.UITextBox();
@@ -50,17 +59,9 @@
this.uiButton2 = new Sunny.UI.UIButton();
this.uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel();
this.uiPanel3 = new Sunny.UI.UIPanel();
this.uiButton3 = new Sunny.UI.UIButton();
this.uiPanel2 = new Sunny.UI.UIPanel();
this.uiPanel1 = new Sunny.UI.UIPanel();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SerialNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.uiDataGridView1)).BeginInit();
this.uiTableLayoutPanel1.SuspendLayout();
this.uiPanel3.SuspendLayout();
@@ -132,6 +133,7 @@
this.uiDataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.uiDataGridView1.Location = new System.Drawing.Point(0, 0);
this.uiDataGridView1.Name = "uiDataGridView1";
this.uiDataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 10.5F);
@@ -156,6 +158,86 @@
this.uiDataGridView1.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.uiDataGridView1_RowsAdded);
this.uiDataGridView1.RowsRemoved += new System.Windows.Forms.DataGridViewRowsRemovedEventHandler(this.uiDataGridView1_RowsRemoved);
//
// Column1
//
this.Column1.DataPropertyName = "Id";
this.Column1.HeaderText = "编号";
this.Column1.MinimumWidth = 6;
this.Column1.Name = "Column1";
this.Column1.ReadOnly = true;
this.Column1.Width = 75;
//
// SerialNumber
//
this.SerialNumber.HeaderText = "序号";
this.SerialNumber.MinimumWidth = 8;
this.SerialNumber.Name = "SerialNumber";
this.SerialNumber.ReadOnly = true;
this.SerialNumber.Width = 75;
//
// Column2
//
this.Column2.DataPropertyName = "barcode";
this.Column2.HeaderText = "条码";
this.Column2.MinimumWidth = 6;
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
this.Column2.Width = 200;
//
// Column3
//
this.Column3.DataPropertyName = "diffpressure";
this.Column3.HeaderText = "压力(PSI)";
this.Column3.MinimumWidth = 6;
this.Column3.Name = "Column3";
this.Column3.ReadOnly = true;
this.Column3.Width = 150;
//
// Column4
//
this.Column4.DataPropertyName = "temperature";
this.Column4.HeaderText = "出口温度(℃)";
this.Column4.MinimumWidth = 6;
this.Column4.Name = "Column4";
this.Column4.ReadOnly = true;
this.Column4.Width = 110;
//
// Column7
//
this.Column7.DataPropertyName = "temperature";
this.Column7.HeaderText = "温度(℃)";
this.Column7.MinimumWidth = 6;
this.Column7.Name = "Column7";
this.Column7.ReadOnly = true;
this.Column7.Width = 150;
//
// Column5
//
this.Column5.DataPropertyName = "dwelltime";
this.Column5.HeaderText = "保压时间(h)";
this.Column5.MinimumWidth = 6;
this.Column5.Name = "Column5";
this.Column5.ReadOnly = true;
this.Column5.Width = 110;
//
// Column8
//
this.Column8.DataPropertyName = "TemperatureMode";
this.Column8.HeaderText = "温度模式";
this.Column8.MinimumWidth = 8;
this.Column8.Name = "Column8";
this.Column8.ReadOnly = true;
this.Column8.Width = 110;
//
// Column6
//
this.Column6.DataPropertyName = "CreateTime";
this.Column6.HeaderText = "录入时间";
this.Column6.MinimumWidth = 6;
this.Column6.Name = "Column6";
this.Column6.ReadOnly = true;
this.Column6.Width = 150;
//
// uiTextBox2
//
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
@@ -375,6 +457,7 @@
//
// uiPanel3
//
this.uiPanel3.Controls.Add(this.uiButton3);
this.uiPanel3.Controls.Add(this.save);
this.uiPanel3.Controls.Add(this.uiButton2);
this.uiPanel3.Controls.Add(this.uiButton1);
@@ -389,6 +472,27 @@
this.uiPanel3.Text = null;
this.uiPanel3.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// uiButton3
//
this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiButton3.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
this.uiButton3.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(130)))), ((int)(((byte)(210)))), ((int)(((byte)(60)))));
this.uiButton3.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(200)))), ((int)(((byte)(50)))));
this.uiButton3.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(30)))));
this.uiButton3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton3.Location = new System.Drawing.Point(859, 43);
this.uiButton3.MinimumSize = new System.Drawing.Size(1, 1);
this.uiButton3.Name = "uiButton3";
this.uiButton3.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
this.uiButton3.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(200)))), ((int)(((byte)(50)))));
this.uiButton3.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(30)))));
this.uiButton3.Size = new System.Drawing.Size(130, 50);
this.uiButton3.Style = Sunny.UI.UIStyle.Custom;
this.uiButton3.TabIndex = 39;
this.uiButton3.Text = "退出";
this.uiButton3.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiButton3.Click += new System.EventHandler(this.uiButton3_Click);
//
// uiPanel2
//
this.uiPanel2.Controls.Add(this.uiLabel48);
@@ -427,84 +531,6 @@
this.uiPanel1.Text = null;
this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
//
// Column1
//
this.Column1.DataPropertyName = "Id";
this.Column1.HeaderText = "编号";
this.Column1.MinimumWidth = 6;
this.Column1.Name = "Column1";
this.Column1.ReadOnly = true;
this.Column1.Width = 75;
//
// SerialNumber
//
this.SerialNumber.HeaderText = "序号";
this.SerialNumber.MinimumWidth = 8;
this.SerialNumber.Name = "SerialNumber";
this.SerialNumber.ReadOnly = true;
this.SerialNumber.Width = 75;
//
// Column2
//
this.Column2.DataPropertyName = "barcode";
this.Column2.HeaderText = "条码";
this.Column2.MinimumWidth = 6;
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
this.Column2.Width = 200;
//
// Column3
//
this.Column3.DataPropertyName = "diffpressure";
this.Column3.HeaderText = "压力(PSI)";
this.Column3.MinimumWidth = 6;
this.Column3.Name = "Column3";
this.Column3.ReadOnly = true;
//
// Column4
//
this.Column4.DataPropertyName = "temperature";
this.Column4.HeaderText = "出口温度(℃)";
this.Column4.MinimumWidth = 6;
this.Column4.Name = "Column4";
this.Column4.ReadOnly = true;
this.Column4.Width = 110;
//
// Column7
//
this.Column7.DataPropertyName = "temperature";
this.Column7.HeaderText = "温度(℃)";
this.Column7.MinimumWidth = 6;
this.Column7.Name = "Column7";
this.Column7.ReadOnly = true;
//
// Column5
//
this.Column5.DataPropertyName = "dwelltime";
this.Column5.HeaderText = "保压时间(h)";
this.Column5.MinimumWidth = 6;
this.Column5.Name = "Column5";
this.Column5.ReadOnly = true;
this.Column5.Width = 110;
//
// Column8
//
this.Column8.DataPropertyName = "TemperatureMode";
this.Column8.HeaderText = "温度模式";
this.Column8.MinimumWidth = 8;
this.Column8.Name = "Column8";
this.Column8.ReadOnly = true;
this.Column8.Width = 110;
//
// Column6
//
this.Column6.DataPropertyName = "CreateTime";
this.Column6.HeaderText = "录入时间";
this.Column6.MinimumWidth = 6;
this.Column6.Name = "Column6";
this.Column6.ReadOnly = true;
this.Column6.Width = 150;
//
// ScanImport
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -554,5 +580,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
private Sunny.UI.UIButton uiButton3;
}
}

View File

@@ -277,5 +277,13 @@ namespace 全自动水压检测仪
// 当移除行时更新序号
SetRowNumbers();
}
private void uiButton3_Click(object sender, EventArgs e)
{
Application.Restart();
// 关闭当前窗口
Environment.Exit(0);
}
}
}