bug
lu
2025-11-06 d7c8c7c50777026e61b221528cd93f929e8e51ec
bug
已修改3个文件
64 ■■■■ 文件已修改
DevApp/Gs.DevApp/ToolBox/MsgHelper.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/XtraForm1.Designer.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/XtraForm1.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DevApp/Gs.DevApp/ToolBox/MsgHelper.cs
@@ -49,7 +49,6 @@
                innerMsg = e.InnerException.Message;
                s += "\n" + innerMsg;
            }
            Warning(s);
        }
DevApp/Gs.DevApp/XtraForm1.Designer.cs
@@ -35,11 +35,12 @@
            this.label1 = new System.Windows.Forms.Label();
            this.txt_slaveAddress = new DevExpress.XtraEditors.ComboBoxEdit();
            this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
            this.button1 = new System.Windows.Forms.Button();
            this.btnEdit = new DevExpress.XtraEditors.ButtonEdit();
            this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
            this.txtGWM = new DevExpress.XtraEditors.TextEdit();
            this.button1 = new System.Windows.Forms.Button();
            this.simpleButton3 = new DevExpress.XtraEditors.SimpleButton();
            ((System.ComponentModel.ISupportInitialize)(this.txtGs.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txt_slaveAddress.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
@@ -50,7 +51,7 @@
            // 
            // simpleButton2
            // 
            this.simpleButton2.Location = new System.Drawing.Point(447, 29);
            this.simpleButton2.Location = new System.Drawing.Point(396, 49);
            this.simpleButton2.Name = "simpleButton2";
            this.simpleButton2.Size = new System.Drawing.Size(201, 29);
            this.simpleButton2.TabIndex = 1;
@@ -114,6 +115,7 @@
            // 
            // panelControl1
            // 
            this.panelControl1.Controls.Add(this.simpleButton3);
            this.panelControl1.Controls.Add(this.button1);
            this.panelControl1.Controls.Add(this.btnEdit);
            this.panelControl1.Controls.Add(this.simpleButton1);
@@ -129,6 +131,16 @@
            this.panelControl1.Name = "panelControl1";
            this.panelControl1.Size = new System.Drawing.Size(887, 120);
            this.panelControl1.TabIndex = 7;
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(699, 29);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 11;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // btnEdit
            // 
@@ -164,15 +176,14 @@
            this.txtGWM.Size = new System.Drawing.Size(183, 24);
            this.txtGWM.TabIndex = 7;
            // 
            // button1
            // simpleButton3
            // 
            this.button1.Location = new System.Drawing.Point(699, 29);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 11;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            this.simpleButton3.Location = new System.Drawing.Point(475, 6);
            this.simpleButton3.Name = "simpleButton3";
            this.simpleButton3.Size = new System.Drawing.Size(94, 29);
            this.simpleButton3.TabIndex = 12;
            this.simpleButton3.Text = "simpleButton3";
            this.simpleButton3.Click += new System.EventHandler(this.simpleButton3_Click);
            // 
            // XtraForm1
            // 
@@ -207,5 +218,6 @@
        private DevExpress.XtraEditors.SimpleButton simpleButton1;
        private DevExpress.XtraEditors.ButtonEdit btnEdit;
        private System.Windows.Forms.Button button1;
        private DevExpress.XtraEditors.SimpleButton simpleButton3;
    }
}
DevApp/Gs.DevApp/XtraForm1.cs
@@ -324,5 +324,36 @@
            }
            richTextBox1.Text = sbLine.ToString();
        }
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            string ddd = "1";
            try
            {
                if (IsValidDate(ddd, "日期"))
                    MessageBox.Show("正常");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// 判断是否为日期
        /// </summary>
        /// <param name="dateString"></param>
        /// <returns></returns>
        public  bool IsValidDate(string dateString, string ziDuan = "")
        {
            bool bl = DateTime.TryParse(dateString, out _);
            if (bl == true)
                return bl;
            if (string.IsNullOrEmpty(ziDuan))
                return bl;
            throw new Exception(ziDuan + "不是合法的日期类型!");
        }
    }
}