diff --git a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs index e4673ed..08b1821 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs @@ -31,11 +31,6 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RbFreqStdMeas)); this.panMenu = new System.Windows.Forms.Panel(); - this.panelMain = new System.Windows.Forms.Panel(); - this.penBanner = new System.Windows.Forms.Panel(); - this.btnMinSys = new System.Windows.Forms.Button(); - this.btnExitSys = new System.Windows.Forms.Button(); - this.labTitle = new System.Windows.Forms.Label(); this.panDev = new Casic.Birmm.RbFreqStandMeasure.RoundPanel(); this.labDevText = new System.Windows.Forms.Label(); this.labDevSelected = new System.Windows.Forms.Label(); @@ -60,8 +55,12 @@ this.labCounterSelected = new System.Windows.Forms.Label(); this.labCounterText = new System.Windows.Forms.Label(); this.picIconCounter = new System.Windows.Forms.PictureBox(); + this.panelMain = new System.Windows.Forms.Panel(); + this.penBanner = new System.Windows.Forms.Panel(); + this.btnMinSys = new System.Windows.Forms.Button(); + this.btnExitSys = new System.Windows.Forms.Button(); + this.labTitle = new System.Windows.Forms.Label(); this.panMenu.SuspendLayout(); - this.penBanner.SuspendLayout(); this.panDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).BeginInit(); this.panSetting.SuspendLayout(); @@ -74,6 +73,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).BeginInit(); this.panCounter.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).BeginInit(); + this.penBanner.SuspendLayout(); this.SuspendLayout(); // // panMenu @@ -90,72 +90,6 @@ this.panMenu.Size = new System.Drawing.Size(1024, 50); this.panMenu.TabIndex = 1; // - // panelMain - // - this.panelMain.Location = new System.Drawing.Point(0, 114); - this.panelMain.Name = "panelMain"; - this.panelMain.Size = new System.Drawing.Size(1024, 654); - this.panelMain.TabIndex = 2; - // - // penBanner - // - this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; - this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.penBanner.Controls.Add(this.btnMinSys); - this.penBanner.Controls.Add(this.btnExitSys); - this.penBanner.Controls.Add(this.labTitle); - this.penBanner.Location = new System.Drawing.Point(0, 0); - this.penBanner.Name = "penBanner"; - this.penBanner.Size = new System.Drawing.Size(1024, 64); - this.penBanner.TabIndex = 0; - this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); - // - // btnMinSys - // - this.btnMinSys.BackColor = System.Drawing.Color.Transparent; - this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; - this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnMinSys.FlatAppearance.BorderSize = 0; - this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnMinSys.Location = new System.Drawing.Point(944, 22); - this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); - this.btnMinSys.Name = "btnMinSys"; - this.btnMinSys.Size = new System.Drawing.Size(20, 20); - this.btnMinSys.TabIndex = 1; - this.btnMinSys.UseVisualStyleBackColor = false; - this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); - this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); - // - // btnExitSys - // - this.btnExitSys.BackColor = System.Drawing.Color.Transparent; - this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; - this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnExitSys.FlatAppearance.BorderSize = 0; - this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnExitSys.Location = new System.Drawing.Point(974, 22); - this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); - this.btnExitSys.Name = "btnExitSys"; - this.btnExitSys.Size = new System.Drawing.Size(20, 20); - this.btnExitSys.TabIndex = 1; - this.btnExitSys.UseVisualStyleBackColor = false; - this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); - this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); - // - // labTitle - // - this.labTitle.BackColor = System.Drawing.Color.Transparent; - this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labTitle.ForeColor = System.Drawing.Color.White; - this.labTitle.Location = new System.Drawing.Point(30, 16); - this.labTitle.Name = "labTitle"; - this.labTitle.Size = new System.Drawing.Size(300, 32); - this.labTitle.TabIndex = 0; - this.labTitle.Text = "铷原子频标比对测量软件"; - this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // panDev // this.panDev.Back = System.Drawing.Color.Empty; @@ -486,6 +420,72 @@ this.picIconCounter.MouseLeave += new System.EventHandler(this.panCounter_MouseLeave); this.picIconCounter.MouseHover += new System.EventHandler(this.panCounter_MouseHover); // + // panelMain + // + this.panelMain.Location = new System.Drawing.Point(0, 114); + this.panelMain.Name = "panelMain"; + this.panelMain.Size = new System.Drawing.Size(1024, 654); + this.panelMain.TabIndex = 2; + // + // penBanner + // + this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; + this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.penBanner.Controls.Add(this.btnMinSys); + this.penBanner.Controls.Add(this.btnExitSys); + this.penBanner.Controls.Add(this.labTitle); + this.penBanner.Location = new System.Drawing.Point(0, 0); + this.penBanner.Name = "penBanner"; + this.penBanner.Size = new System.Drawing.Size(1024, 64); + this.penBanner.TabIndex = 0; + this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); + // + // btnMinSys + // + this.btnMinSys.BackColor = System.Drawing.Color.Transparent; + this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; + this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnMinSys.FlatAppearance.BorderSize = 0; + this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnMinSys.Location = new System.Drawing.Point(944, 22); + this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); + this.btnMinSys.Name = "btnMinSys"; + this.btnMinSys.Size = new System.Drawing.Size(20, 20); + this.btnMinSys.TabIndex = 1; + this.btnMinSys.UseVisualStyleBackColor = false; + this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); + this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); + // + // btnExitSys + // + this.btnExitSys.BackColor = System.Drawing.Color.Transparent; + this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; + this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnExitSys.FlatAppearance.BorderSize = 0; + this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnExitSys.Location = new System.Drawing.Point(974, 22); + this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); + this.btnExitSys.Name = "btnExitSys"; + this.btnExitSys.Size = new System.Drawing.Size(20, 20); + this.btnExitSys.TabIndex = 1; + this.btnExitSys.UseVisualStyleBackColor = false; + this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); + this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); + // + // labTitle + // + this.labTitle.BackColor = System.Drawing.Color.Transparent; + this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labTitle.ForeColor = System.Drawing.Color.White; + this.labTitle.Location = new System.Drawing.Point(30, 16); + this.labTitle.Name = "labTitle"; + this.labTitle.Size = new System.Drawing.Size(300, 32); + this.labTitle.TabIndex = 0; + this.labTitle.Text = "铷原子频标比对测量软件"; + this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // RbFreqStdMeas // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -498,9 +498,9 @@ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "RbFreqStdMeas"; this.Text = "RbFreqStdMeas"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RbFreqStdMeas_FormClosing); this.Load += new System.EventHandler(this.RbFreqStdMeas_Load); this.panMenu.ResumeLayout(false); - this.penBanner.ResumeLayout(false); this.panDev.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).EndInit(); this.panSetting.ResumeLayout(false); @@ -513,6 +513,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).EndInit(); this.panCounter.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).EndInit(); + this.penBanner.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs index e4673ed..08b1821 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs @@ -31,11 +31,6 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RbFreqStdMeas)); this.panMenu = new System.Windows.Forms.Panel(); - this.panelMain = new System.Windows.Forms.Panel(); - this.penBanner = new System.Windows.Forms.Panel(); - this.btnMinSys = new System.Windows.Forms.Button(); - this.btnExitSys = new System.Windows.Forms.Button(); - this.labTitle = new System.Windows.Forms.Label(); this.panDev = new Casic.Birmm.RbFreqStandMeasure.RoundPanel(); this.labDevText = new System.Windows.Forms.Label(); this.labDevSelected = new System.Windows.Forms.Label(); @@ -60,8 +55,12 @@ this.labCounterSelected = new System.Windows.Forms.Label(); this.labCounterText = new System.Windows.Forms.Label(); this.picIconCounter = new System.Windows.Forms.PictureBox(); + this.panelMain = new System.Windows.Forms.Panel(); + this.penBanner = new System.Windows.Forms.Panel(); + this.btnMinSys = new System.Windows.Forms.Button(); + this.btnExitSys = new System.Windows.Forms.Button(); + this.labTitle = new System.Windows.Forms.Label(); this.panMenu.SuspendLayout(); - this.penBanner.SuspendLayout(); this.panDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).BeginInit(); this.panSetting.SuspendLayout(); @@ -74,6 +73,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).BeginInit(); this.panCounter.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).BeginInit(); + this.penBanner.SuspendLayout(); this.SuspendLayout(); // // panMenu @@ -90,72 +90,6 @@ this.panMenu.Size = new System.Drawing.Size(1024, 50); this.panMenu.TabIndex = 1; // - // panelMain - // - this.panelMain.Location = new System.Drawing.Point(0, 114); - this.panelMain.Name = "panelMain"; - this.panelMain.Size = new System.Drawing.Size(1024, 654); - this.panelMain.TabIndex = 2; - // - // penBanner - // - this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; - this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.penBanner.Controls.Add(this.btnMinSys); - this.penBanner.Controls.Add(this.btnExitSys); - this.penBanner.Controls.Add(this.labTitle); - this.penBanner.Location = new System.Drawing.Point(0, 0); - this.penBanner.Name = "penBanner"; - this.penBanner.Size = new System.Drawing.Size(1024, 64); - this.penBanner.TabIndex = 0; - this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); - // - // btnMinSys - // - this.btnMinSys.BackColor = System.Drawing.Color.Transparent; - this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; - this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnMinSys.FlatAppearance.BorderSize = 0; - this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnMinSys.Location = new System.Drawing.Point(944, 22); - this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); - this.btnMinSys.Name = "btnMinSys"; - this.btnMinSys.Size = new System.Drawing.Size(20, 20); - this.btnMinSys.TabIndex = 1; - this.btnMinSys.UseVisualStyleBackColor = false; - this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); - this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); - // - // btnExitSys - // - this.btnExitSys.BackColor = System.Drawing.Color.Transparent; - this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; - this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnExitSys.FlatAppearance.BorderSize = 0; - this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnExitSys.Location = new System.Drawing.Point(974, 22); - this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); - this.btnExitSys.Name = "btnExitSys"; - this.btnExitSys.Size = new System.Drawing.Size(20, 20); - this.btnExitSys.TabIndex = 1; - this.btnExitSys.UseVisualStyleBackColor = false; - this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); - this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); - // - // labTitle - // - this.labTitle.BackColor = System.Drawing.Color.Transparent; - this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labTitle.ForeColor = System.Drawing.Color.White; - this.labTitle.Location = new System.Drawing.Point(30, 16); - this.labTitle.Name = "labTitle"; - this.labTitle.Size = new System.Drawing.Size(300, 32); - this.labTitle.TabIndex = 0; - this.labTitle.Text = "铷原子频标比对测量软件"; - this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // panDev // this.panDev.Back = System.Drawing.Color.Empty; @@ -486,6 +420,72 @@ this.picIconCounter.MouseLeave += new System.EventHandler(this.panCounter_MouseLeave); this.picIconCounter.MouseHover += new System.EventHandler(this.panCounter_MouseHover); // + // panelMain + // + this.panelMain.Location = new System.Drawing.Point(0, 114); + this.panelMain.Name = "panelMain"; + this.panelMain.Size = new System.Drawing.Size(1024, 654); + this.panelMain.TabIndex = 2; + // + // penBanner + // + this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; + this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.penBanner.Controls.Add(this.btnMinSys); + this.penBanner.Controls.Add(this.btnExitSys); + this.penBanner.Controls.Add(this.labTitle); + this.penBanner.Location = new System.Drawing.Point(0, 0); + this.penBanner.Name = "penBanner"; + this.penBanner.Size = new System.Drawing.Size(1024, 64); + this.penBanner.TabIndex = 0; + this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); + // + // btnMinSys + // + this.btnMinSys.BackColor = System.Drawing.Color.Transparent; + this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; + this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnMinSys.FlatAppearance.BorderSize = 0; + this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnMinSys.Location = new System.Drawing.Point(944, 22); + this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); + this.btnMinSys.Name = "btnMinSys"; + this.btnMinSys.Size = new System.Drawing.Size(20, 20); + this.btnMinSys.TabIndex = 1; + this.btnMinSys.UseVisualStyleBackColor = false; + this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); + this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); + // + // btnExitSys + // + this.btnExitSys.BackColor = System.Drawing.Color.Transparent; + this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; + this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnExitSys.FlatAppearance.BorderSize = 0; + this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnExitSys.Location = new System.Drawing.Point(974, 22); + this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); + this.btnExitSys.Name = "btnExitSys"; + this.btnExitSys.Size = new System.Drawing.Size(20, 20); + this.btnExitSys.TabIndex = 1; + this.btnExitSys.UseVisualStyleBackColor = false; + this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); + this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); + // + // labTitle + // + this.labTitle.BackColor = System.Drawing.Color.Transparent; + this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labTitle.ForeColor = System.Drawing.Color.White; + this.labTitle.Location = new System.Drawing.Point(30, 16); + this.labTitle.Name = "labTitle"; + this.labTitle.Size = new System.Drawing.Size(300, 32); + this.labTitle.TabIndex = 0; + this.labTitle.Text = "铷原子频标比对测量软件"; + this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // RbFreqStdMeas // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -498,9 +498,9 @@ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "RbFreqStdMeas"; this.Text = "RbFreqStdMeas"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RbFreqStdMeas_FormClosing); this.Load += new System.EventHandler(this.RbFreqStdMeas_Load); this.panMenu.ResumeLayout(false); - this.penBanner.ResumeLayout(false); this.panDev.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).EndInit(); this.panSetting.ResumeLayout(false); @@ -513,6 +513,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).EndInit(); this.panCounter.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).EndInit(); + this.penBanner.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index 1b58939..fdd6255 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -18,8 +18,11 @@ namespace Casic.Birmm.RbFreqStandMeasure { + public partial class RbFreqStdMeas : Form { + private bool closeClicked = false; + private bool closed = false; #region 无边框拖动效果/最小化窗口/关闭窗口 [DllImport("user32.dll")]//拖动无窗体的控件 @@ -43,12 +46,13 @@ #endregion private void btnExitSys_Click(object sender, EventArgs e) { - + closeClicked = true; DeviceService deviceService = new DeviceServiceImpl(); List list = deviceService.getDeviceByChannel(); if (list != null && list.Count > 0) { MessageBox.Show("有正在检测的仪器,请先停止检测再退出软件!"); + closeClicked = false; return; } if (MessageBox.Show("确认退出软件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -60,10 +64,12 @@ } FreshStatus.portClock.Dispose(); FreshStatus.portSatellite.Dispose(); - Application.Exit(); } - + else + { + closeClicked = false; + } } private void btnMinSys_Click(object sender, EventArgs e) { @@ -554,5 +560,42 @@ break; } } + + private void RbFreqStdMeas_FormClosing(object sender, FormClosingEventArgs e) + { + if (!closeClicked && !closed) + { + closed = true; + DeviceService deviceService = new DeviceServiceImpl(); + List list = deviceService.getDeviceByChannel(); + if (list != null && list.Count > 0) + { + MessageBox.Show("有正在检测的仪器,请先停止检测再退出软件!"); + + closed = false; + e.Cancel = true; + return; + } + if (MessageBox.Show("确认退出软件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) + == DialogResult.Yes) + { + foreach (SerialPort port in portList) + { + port.Dispose(); + } + FreshStatus.portClock.Dispose(); + FreshStatus.portSatellite.Dispose(); + + Application.Exit(); + } + else + { + closed = false; + e.Cancel = true; + } + } + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs index e4673ed..08b1821 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs @@ -31,11 +31,6 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RbFreqStdMeas)); this.panMenu = new System.Windows.Forms.Panel(); - this.panelMain = new System.Windows.Forms.Panel(); - this.penBanner = new System.Windows.Forms.Panel(); - this.btnMinSys = new System.Windows.Forms.Button(); - this.btnExitSys = new System.Windows.Forms.Button(); - this.labTitle = new System.Windows.Forms.Label(); this.panDev = new Casic.Birmm.RbFreqStandMeasure.RoundPanel(); this.labDevText = new System.Windows.Forms.Label(); this.labDevSelected = new System.Windows.Forms.Label(); @@ -60,8 +55,12 @@ this.labCounterSelected = new System.Windows.Forms.Label(); this.labCounterText = new System.Windows.Forms.Label(); this.picIconCounter = new System.Windows.Forms.PictureBox(); + this.panelMain = new System.Windows.Forms.Panel(); + this.penBanner = new System.Windows.Forms.Panel(); + this.btnMinSys = new System.Windows.Forms.Button(); + this.btnExitSys = new System.Windows.Forms.Button(); + this.labTitle = new System.Windows.Forms.Label(); this.panMenu.SuspendLayout(); - this.penBanner.SuspendLayout(); this.panDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).BeginInit(); this.panSetting.SuspendLayout(); @@ -74,6 +73,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).BeginInit(); this.panCounter.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).BeginInit(); + this.penBanner.SuspendLayout(); this.SuspendLayout(); // // panMenu @@ -90,72 +90,6 @@ this.panMenu.Size = new System.Drawing.Size(1024, 50); this.panMenu.TabIndex = 1; // - // panelMain - // - this.panelMain.Location = new System.Drawing.Point(0, 114); - this.panelMain.Name = "panelMain"; - this.panelMain.Size = new System.Drawing.Size(1024, 654); - this.panelMain.TabIndex = 2; - // - // penBanner - // - this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; - this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.penBanner.Controls.Add(this.btnMinSys); - this.penBanner.Controls.Add(this.btnExitSys); - this.penBanner.Controls.Add(this.labTitle); - this.penBanner.Location = new System.Drawing.Point(0, 0); - this.penBanner.Name = "penBanner"; - this.penBanner.Size = new System.Drawing.Size(1024, 64); - this.penBanner.TabIndex = 0; - this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); - // - // btnMinSys - // - this.btnMinSys.BackColor = System.Drawing.Color.Transparent; - this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; - this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnMinSys.FlatAppearance.BorderSize = 0; - this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnMinSys.Location = new System.Drawing.Point(944, 22); - this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); - this.btnMinSys.Name = "btnMinSys"; - this.btnMinSys.Size = new System.Drawing.Size(20, 20); - this.btnMinSys.TabIndex = 1; - this.btnMinSys.UseVisualStyleBackColor = false; - this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); - this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); - // - // btnExitSys - // - this.btnExitSys.BackColor = System.Drawing.Color.Transparent; - this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; - this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnExitSys.FlatAppearance.BorderSize = 0; - this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnExitSys.Location = new System.Drawing.Point(974, 22); - this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); - this.btnExitSys.Name = "btnExitSys"; - this.btnExitSys.Size = new System.Drawing.Size(20, 20); - this.btnExitSys.TabIndex = 1; - this.btnExitSys.UseVisualStyleBackColor = false; - this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); - this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); - // - // labTitle - // - this.labTitle.BackColor = System.Drawing.Color.Transparent; - this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labTitle.ForeColor = System.Drawing.Color.White; - this.labTitle.Location = new System.Drawing.Point(30, 16); - this.labTitle.Name = "labTitle"; - this.labTitle.Size = new System.Drawing.Size(300, 32); - this.labTitle.TabIndex = 0; - this.labTitle.Text = "铷原子频标比对测量软件"; - this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // panDev // this.panDev.Back = System.Drawing.Color.Empty; @@ -486,6 +420,72 @@ this.picIconCounter.MouseLeave += new System.EventHandler(this.panCounter_MouseLeave); this.picIconCounter.MouseHover += new System.EventHandler(this.panCounter_MouseHover); // + // panelMain + // + this.panelMain.Location = new System.Drawing.Point(0, 114); + this.panelMain.Name = "panelMain"; + this.panelMain.Size = new System.Drawing.Size(1024, 654); + this.panelMain.TabIndex = 2; + // + // penBanner + // + this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; + this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.penBanner.Controls.Add(this.btnMinSys); + this.penBanner.Controls.Add(this.btnExitSys); + this.penBanner.Controls.Add(this.labTitle); + this.penBanner.Location = new System.Drawing.Point(0, 0); + this.penBanner.Name = "penBanner"; + this.penBanner.Size = new System.Drawing.Size(1024, 64); + this.penBanner.TabIndex = 0; + this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); + // + // btnMinSys + // + this.btnMinSys.BackColor = System.Drawing.Color.Transparent; + this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; + this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnMinSys.FlatAppearance.BorderSize = 0; + this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnMinSys.Location = new System.Drawing.Point(944, 22); + this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); + this.btnMinSys.Name = "btnMinSys"; + this.btnMinSys.Size = new System.Drawing.Size(20, 20); + this.btnMinSys.TabIndex = 1; + this.btnMinSys.UseVisualStyleBackColor = false; + this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); + this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); + // + // btnExitSys + // + this.btnExitSys.BackColor = System.Drawing.Color.Transparent; + this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; + this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnExitSys.FlatAppearance.BorderSize = 0; + this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnExitSys.Location = new System.Drawing.Point(974, 22); + this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); + this.btnExitSys.Name = "btnExitSys"; + this.btnExitSys.Size = new System.Drawing.Size(20, 20); + this.btnExitSys.TabIndex = 1; + this.btnExitSys.UseVisualStyleBackColor = false; + this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); + this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); + // + // labTitle + // + this.labTitle.BackColor = System.Drawing.Color.Transparent; + this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labTitle.ForeColor = System.Drawing.Color.White; + this.labTitle.Location = new System.Drawing.Point(30, 16); + this.labTitle.Name = "labTitle"; + this.labTitle.Size = new System.Drawing.Size(300, 32); + this.labTitle.TabIndex = 0; + this.labTitle.Text = "铷原子频标比对测量软件"; + this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // RbFreqStdMeas // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -498,9 +498,9 @@ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "RbFreqStdMeas"; this.Text = "RbFreqStdMeas"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RbFreqStdMeas_FormClosing); this.Load += new System.EventHandler(this.RbFreqStdMeas_Load); this.panMenu.ResumeLayout(false); - this.penBanner.ResumeLayout(false); this.panDev.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).EndInit(); this.panSetting.ResumeLayout(false); @@ -513,6 +513,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).EndInit(); this.panCounter.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).EndInit(); + this.penBanner.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index 1b58939..fdd6255 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -18,8 +18,11 @@ namespace Casic.Birmm.RbFreqStandMeasure { + public partial class RbFreqStdMeas : Form { + private bool closeClicked = false; + private bool closed = false; #region 无边框拖动效果/最小化窗口/关闭窗口 [DllImport("user32.dll")]//拖动无窗体的控件 @@ -43,12 +46,13 @@ #endregion private void btnExitSys_Click(object sender, EventArgs e) { - + closeClicked = true; DeviceService deviceService = new DeviceServiceImpl(); List list = deviceService.getDeviceByChannel(); if (list != null && list.Count > 0) { MessageBox.Show("有正在检测的仪器,请先停止检测再退出软件!"); + closeClicked = false; return; } if (MessageBox.Show("确认退出软件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -60,10 +64,12 @@ } FreshStatus.portClock.Dispose(); FreshStatus.portSatellite.Dispose(); - Application.Exit(); } - + else + { + closeClicked = false; + } } private void btnMinSys_Click(object sender, EventArgs e) { @@ -554,5 +560,42 @@ break; } } + + private void RbFreqStdMeas_FormClosing(object sender, FormClosingEventArgs e) + { + if (!closeClicked && !closed) + { + closed = true; + DeviceService deviceService = new DeviceServiceImpl(); + List list = deviceService.getDeviceByChannel(); + if (list != null && list.Count > 0) + { + MessageBox.Show("有正在检测的仪器,请先停止检测再退出软件!"); + + closed = false; + e.Cancel = true; + return; + } + if (MessageBox.Show("确认退出软件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) + == DialogResult.Yes) + { + foreach (SerialPort port in portList) + { + port.Dispose(); + } + FreshStatus.portClock.Dispose(); + FreshStatus.portSatellite.Dispose(); + + Application.Exit(); + } + else + { + closed = false; + e.Cancel = true; + } + } + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 5fd0419..d947344 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs index e4673ed..08b1821 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.Designer.cs @@ -31,11 +31,6 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RbFreqStdMeas)); this.panMenu = new System.Windows.Forms.Panel(); - this.panelMain = new System.Windows.Forms.Panel(); - this.penBanner = new System.Windows.Forms.Panel(); - this.btnMinSys = new System.Windows.Forms.Button(); - this.btnExitSys = new System.Windows.Forms.Button(); - this.labTitle = new System.Windows.Forms.Label(); this.panDev = new Casic.Birmm.RbFreqStandMeasure.RoundPanel(); this.labDevText = new System.Windows.Forms.Label(); this.labDevSelected = new System.Windows.Forms.Label(); @@ -60,8 +55,12 @@ this.labCounterSelected = new System.Windows.Forms.Label(); this.labCounterText = new System.Windows.Forms.Label(); this.picIconCounter = new System.Windows.Forms.PictureBox(); + this.panelMain = new System.Windows.Forms.Panel(); + this.penBanner = new System.Windows.Forms.Panel(); + this.btnMinSys = new System.Windows.Forms.Button(); + this.btnExitSys = new System.Windows.Forms.Button(); + this.labTitle = new System.Windows.Forms.Label(); this.panMenu.SuspendLayout(); - this.penBanner.SuspendLayout(); this.panDev.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).BeginInit(); this.panSetting.SuspendLayout(); @@ -74,6 +73,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).BeginInit(); this.panCounter.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).BeginInit(); + this.penBanner.SuspendLayout(); this.SuspendLayout(); // // panMenu @@ -90,72 +90,6 @@ this.panMenu.Size = new System.Drawing.Size(1024, 50); this.panMenu.TabIndex = 1; // - // panelMain - // - this.panelMain.Location = new System.Drawing.Point(0, 114); - this.panelMain.Name = "panelMain"; - this.panelMain.Size = new System.Drawing.Size(1024, 654); - this.panelMain.TabIndex = 2; - // - // penBanner - // - this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; - this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.penBanner.Controls.Add(this.btnMinSys); - this.penBanner.Controls.Add(this.btnExitSys); - this.penBanner.Controls.Add(this.labTitle); - this.penBanner.Location = new System.Drawing.Point(0, 0); - this.penBanner.Name = "penBanner"; - this.penBanner.Size = new System.Drawing.Size(1024, 64); - this.penBanner.TabIndex = 0; - this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); - // - // btnMinSys - // - this.btnMinSys.BackColor = System.Drawing.Color.Transparent; - this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; - this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnMinSys.FlatAppearance.BorderSize = 0; - this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnMinSys.Location = new System.Drawing.Point(944, 22); - this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); - this.btnMinSys.Name = "btnMinSys"; - this.btnMinSys.Size = new System.Drawing.Size(20, 20); - this.btnMinSys.TabIndex = 1; - this.btnMinSys.UseVisualStyleBackColor = false; - this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); - this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); - // - // btnExitSys - // - this.btnExitSys.BackColor = System.Drawing.Color.Transparent; - this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; - this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.btnExitSys.FlatAppearance.BorderSize = 0; - this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; - this.btnExitSys.Location = new System.Drawing.Point(974, 22); - this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); - this.btnExitSys.Name = "btnExitSys"; - this.btnExitSys.Size = new System.Drawing.Size(20, 20); - this.btnExitSys.TabIndex = 1; - this.btnExitSys.UseVisualStyleBackColor = false; - this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); - this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); - // - // labTitle - // - this.labTitle.BackColor = System.Drawing.Color.Transparent; - this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); - this.labTitle.ForeColor = System.Drawing.Color.White; - this.labTitle.Location = new System.Drawing.Point(30, 16); - this.labTitle.Name = "labTitle"; - this.labTitle.Size = new System.Drawing.Size(300, 32); - this.labTitle.TabIndex = 0; - this.labTitle.Text = "铷原子频标比对测量软件"; - this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // panDev // this.panDev.Back = System.Drawing.Color.Empty; @@ -486,6 +420,72 @@ this.picIconCounter.MouseLeave += new System.EventHandler(this.panCounter_MouseLeave); this.picIconCounter.MouseHover += new System.EventHandler(this.panCounter_MouseHover); // + // panelMain + // + this.panelMain.Location = new System.Drawing.Point(0, 114); + this.panelMain.Name = "panelMain"; + this.panelMain.Size = new System.Drawing.Size(1024, 654); + this.panelMain.TabIndex = 2; + // + // penBanner + // + this.penBanner.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.bg_banner; + this.penBanner.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.penBanner.Controls.Add(this.btnMinSys); + this.penBanner.Controls.Add(this.btnExitSys); + this.penBanner.Controls.Add(this.labTitle); + this.penBanner.Location = new System.Drawing.Point(0, 0); + this.penBanner.Name = "penBanner"; + this.penBanner.Size = new System.Drawing.Size(1024, 64); + this.penBanner.TabIndex = 0; + this.penBanner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RbFreqStdMeas_MouseDown); + // + // btnMinSys + // + this.btnMinSys.BackColor = System.Drawing.Color.Transparent; + this.btnMinSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_min; + this.btnMinSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnMinSys.FlatAppearance.BorderSize = 0; + this.btnMinSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnMinSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnMinSys.Location = new System.Drawing.Point(944, 22); + this.btnMinSys.Margin = new System.Windows.Forms.Padding(0); + this.btnMinSys.Name = "btnMinSys"; + this.btnMinSys.Size = new System.Drawing.Size(20, 20); + this.btnMinSys.TabIndex = 1; + this.btnMinSys.UseVisualStyleBackColor = false; + this.btnMinSys.Click += new System.EventHandler(this.btnMinSys_Click); + this.btnMinSys.MouseHover += new System.EventHandler(this.btnMinSys_MouseHover); + // + // btnExitSys + // + this.btnExitSys.BackColor = System.Drawing.Color.Transparent; + this.btnExitSys.BackgroundImage = global::Casic.Birmm.RbFreqStandMeasure.Properties.Resources.icon_exit; + this.btnExitSys.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.btnExitSys.FlatAppearance.BorderSize = 0; + this.btnExitSys.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnExitSys.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnExitSys.Location = new System.Drawing.Point(974, 22); + this.btnExitSys.Margin = new System.Windows.Forms.Padding(0); + this.btnExitSys.Name = "btnExitSys"; + this.btnExitSys.Size = new System.Drawing.Size(20, 20); + this.btnExitSys.TabIndex = 1; + this.btnExitSys.UseVisualStyleBackColor = false; + this.btnExitSys.Click += new System.EventHandler(this.btnExitSys_Click); + this.btnExitSys.MouseHover += new System.EventHandler(this.btnExitSys_MouseHover); + // + // labTitle + // + this.labTitle.BackColor = System.Drawing.Color.Transparent; + this.labTitle.Font = new System.Drawing.Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(134))); + this.labTitle.ForeColor = System.Drawing.Color.White; + this.labTitle.Location = new System.Drawing.Point(30, 16); + this.labTitle.Name = "labTitle"; + this.labTitle.Size = new System.Drawing.Size(300, 32); + this.labTitle.TabIndex = 0; + this.labTitle.Text = "铷原子频标比对测量软件"; + this.labTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // // RbFreqStdMeas // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -498,9 +498,9 @@ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "RbFreqStdMeas"; this.Text = "RbFreqStdMeas"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RbFreqStdMeas_FormClosing); this.Load += new System.EventHandler(this.RbFreqStdMeas_Load); this.panMenu.ResumeLayout(false); - this.penBanner.ResumeLayout(false); this.panDev.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconDev)).EndInit(); this.panSetting.ResumeLayout(false); @@ -513,6 +513,7 @@ ((System.ComponentModel.ISupportInitialize)(this.picIconHome)).EndInit(); this.panCounter.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.picIconCounter)).EndInit(); + this.penBanner.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/RbFreqStandMeasure/RbFreqStdMeas.cs b/RbFreqStandMeasure/RbFreqStdMeas.cs index 1b58939..fdd6255 100644 --- a/RbFreqStandMeasure/RbFreqStdMeas.cs +++ b/RbFreqStandMeasure/RbFreqStdMeas.cs @@ -18,8 +18,11 @@ namespace Casic.Birmm.RbFreqStandMeasure { + public partial class RbFreqStdMeas : Form { + private bool closeClicked = false; + private bool closed = false; #region 无边框拖动效果/最小化窗口/关闭窗口 [DllImport("user32.dll")]//拖动无窗体的控件 @@ -43,12 +46,13 @@ #endregion private void btnExitSys_Click(object sender, EventArgs e) { - + closeClicked = true; DeviceService deviceService = new DeviceServiceImpl(); List list = deviceService.getDeviceByChannel(); if (list != null && list.Count > 0) { MessageBox.Show("有正在检测的仪器,请先停止检测再退出软件!"); + closeClicked = false; return; } if (MessageBox.Show("确认退出软件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -60,10 +64,12 @@ } FreshStatus.portClock.Dispose(); FreshStatus.portSatellite.Dispose(); - Application.Exit(); } - + else + { + closeClicked = false; + } } private void btnMinSys_Click(object sender, EventArgs e) { @@ -554,5 +560,42 @@ break; } } + + private void RbFreqStdMeas_FormClosing(object sender, FormClosingEventArgs e) + { + if (!closeClicked && !closed) + { + closed = true; + DeviceService deviceService = new DeviceServiceImpl(); + List list = deviceService.getDeviceByChannel(); + if (list != null && list.Count > 0) + { + MessageBox.Show("有正在检测的仪器,请先停止检测再退出软件!"); + + closed = false; + e.Cancel = true; + return; + } + if (MessageBox.Show("确认退出软件?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) + == DialogResult.Yes) + { + foreach (SerialPort port in portList) + { + port.Dispose(); + } + FreshStatus.portClock.Dispose(); + FreshStatus.portSatellite.Dispose(); + + Application.Exit(); + } + else + { + closed = false; + e.Cancel = true; + } + } + } + + } } \ No newline at end of file diff --git a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe index 5fd0419..d947344 100644 --- a/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe +++ b/RbFreqStandMeasure/bin/Debug/RbFreqStandMeasure.exe Binary files differ diff --git a/RbFreqStandMeasure/counter/CounterCtrlForm.cs b/RbFreqStandMeasure/counter/CounterCtrlForm.cs index 3d6893b..10d1e6f 100644 --- a/RbFreqStandMeasure/counter/CounterCtrlForm.cs +++ b/RbFreqStandMeasure/counter/CounterCtrlForm.cs @@ -8,11 +8,8 @@ using Casic.Birmm.RbFreqStandMeasure.R_DevService.Service.Impl; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; -using System.Linq; -using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Windows.Forms; @@ -654,7 +651,7 @@ table_counterDetecInit.Rows[index][8] = dataId; row.Cells[5].Value = value; row.Cells[6].Value = sensitivityContentParam.VolTage; - row.Cells[7].Value = sensitivityContentParam.CheckTime; + row.Cells[7].Value = sensitivityContentParam.CheckTime.ToString("yyyy-MM-dd HH:mm:ss"); index++; } @@ -749,7 +746,7 @@ dataGridView_CounterResult.Rows[e.RowIndex].Cells[8].Value = initId; } - dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (!String.IsNullOrEmpty(value) && e.ColumnIndex != 4) dataGridView_CounterResult.Rows[e.RowIndex].Cells[7].Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); updateDatabase();