From d437e53b2eea04f88217d719abc8d34ba5b25c2c Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期五, 10 七月 2020 17:36:41 +0800
Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071

---
 src/Bro.UI.Config/MainFrm.cs |   50 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/src/Bro.UI.Config/MainFrm.cs b/src/Bro.UI.Config/MainFrm.cs
index e7940f5..39c3169 100644
--- a/src/Bro.UI.Config/MainFrm.cs
+++ b/src/Bro.UI.Config/MainFrm.cs
@@ -74,10 +74,10 @@
             //});
 
             m_deserializeMenuFrm = new DeserializeDockContent(GetMenuFromPersistString);
-            LoadLayoutFromXML(m_deserializeMenuFrm);
-
             m_deserializeDeviceRunFrm = new DeserializeDockContent(GetAllFormPersistString);
-            _allMenuLoadDoneHandle.Set();
+
+            //LoadLayoutFromXML(m_deserializeMenuFrm);
+            //_allMenuLoadDoneHandle.Set();
 
             Text = SettingHelper.GetProgramDescription();
             string iconPath = SettingHelper.GetProgramIcon();
@@ -90,7 +90,9 @@
         private void RegisterEvent(MenuFrmBase dockFrm)
         {
             dockFrm.OnUploadProcess = DockFrm_OnUploadProcess;
-            dockFrm.OnLogMsgOutput = DockFrm_OnLogMsgOutput;
+
+            dockFrm.OnLogMsgOutput -= DockFrm_OnLogMsgOutput;
+            dockFrm.OnLogMsgOutput += DockFrm_OnLogMsgOutput;
 
             //if (dockFrm is FrmDevices)
             //{
@@ -167,9 +169,14 @@
             });
         }
 
-        private void Process_OnAlarmUpdate(string alarmMsg)
+        private async void Process_OnAlarmUpdate(string alarmMsg)
         {
-            tsslWarning.Text = alarmMsg;
+            this.BeginInvoke(new Action(() =>
+            {
+                tsslWarning.Text = alarmMsg;
+            }));
+
+            await Task.Delay(100);
         }
 
         private ToolStripMenuItem GetMatchNode(ToolStripItemCollection items, string parentMenuCode)
@@ -247,13 +254,16 @@
 
         private void MainFrm_Load(object sender, EventArgs e)
         {
+            LoadLayoutFromXML(m_deserializeMenuFrm);
+            _allMenuLoadDoneHandle.Set();
+
             AdvancedPwdFrm.OnLoginOK = OnLoginOK;
 
-            SpinWait wait = new SpinWait();
-            while (_process == null)
-            {
-                wait.SpinOnce();
-            }
+            //SpinWait wait = new SpinWait();
+            //while (_process == null)
+            //{
+            //    wait.SpinOnce();
+            //}
             LoadLayoutFromXML(m_deserializeDeviceRunFrm);
         }
 
@@ -310,7 +320,7 @@
 
         private void OnLoginOK(bool isLogin)
         {
-            IsLogin = true;
+            IsLogin = isLogin;
         }
         #endregion
 
@@ -535,10 +545,10 @@
 
                 dockFrm.Text = desc[2];
 
-                if (_process != null)
-                {
-                    dockFrm.DownloadProcess(_process);
-                }
+                //if (_process != null)
+                //{
+                //    dockFrm.DownloadProcess(_process);
+                //}
 
                 dockFrm.SetLoginStatus(IsLogin);
 
@@ -573,10 +583,10 @@
 
                 dockFrm.Text = desc[2];
 
-                if (_process != null)
-                {
-                    dockFrm.DownloadProcess(_process);
-                }
+                //if (_process != null)
+                //{
+                //    dockFrm.DownloadProcess(_process);
+                //}
 
                 dockFrm.SetLoginStatus(IsLogin);
 

--
Gitblit v1.8.0