From ee9a20f4f9a02b6203886413b1d71a0219e65457 Mon Sep 17 00:00:00 2001 From: leomon Date: Wed, 30 Aug 2023 22:48:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=94=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AIMSControls/FormMainManage.cs | 36 +++++++++++++------------------- DrawGraph/AreaManage/DBManage.cs | 4 ++-- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/AIMSControls/FormMainManage.cs b/AIMSControls/FormMainManage.cs index 644f4f2..3efbd26 100644 --- a/AIMSControls/FormMainManage.cs +++ b/AIMSControls/FormMainManage.cs @@ -369,9 +369,9 @@ namespace AIMS } public Form GetForm(string Path) { - object result = null; - Type type = Type.GetType(Path); - result = (Form)Activator.CreateInstance(type); + object result = null; + Type type = Type.GetType(Path); + result = (Form)Activator.CreateInstance(type); return (Form)result; } @@ -384,29 +384,23 @@ namespace AIMS private void btnOk_Click(object sender, EventArgs e) { - try + foreach (Form frm in Application.OpenForms) { - foreach (Form frm in Application.OpenForms) + if (frm.Name != "FormLogin" && frm.Name != this.Name) { - if (frm.Name != "frmLogin" && frm.Name != this.Name) - { - frm.Close(); - break; - } - } - foreach (Form frm in Application.OpenForms) - { - if (frm.Name == "frmLogin") - { - frm.Show(); - isClose = true; - this.Close(); - break; - } + frm.Close(); + break; } } - catch (Exception) + foreach (Form frm in Application.OpenForms) { + if (frm.Name == "FormLogin") + { + frm.Show(); + isClose = true; + this.Close(); + break; + } } } bool isClose = false; diff --git a/DrawGraph/AreaManage/DBManage.cs b/DrawGraph/AreaManage/DBManage.cs index 4857ab4..6fb0541 100644 --- a/DrawGraph/AreaManage/DBManage.cs +++ b/DrawGraph/AreaManage/DBManage.cs @@ -196,9 +196,9 @@ namespace DrawGraph } } } - catch (Exception) + catch (Exception ex) { - //PublicMethod.WriteLog(new Exception("回写数据出错:" + propertyName + " 值:" + value + " 错误:" + ex.Message)); + PublicMethod.WriteLog(new Exception("回写数据出错:" + propertyName + " 值:" + value + " 错误:" + ex.Message)); } return i; }