From edc37f77fa57f8923ba28c5c84c29985ea555de8 Mon Sep 17 00:00:00 2001 From: wells.liu <wells.liu@broconcentric.com> Date: 星期六, 11 七月 2020 17:05:01 +0800 Subject: [PATCH] 界面修改 --- src/Bro.UI.Config/MainFrm.cs | 67 ++++++++++++++++++++------------- 1 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/Bro.UI.Config/MainFrm.cs b/src/Bro.UI.Config/MainFrm.cs index a3b3e18..39c3169 100644 --- a/src/Bro.UI.Config/MainFrm.cs +++ b/src/Bro.UI.Config/MainFrm.cs @@ -32,7 +32,7 @@ VisualStudioToolStripExtender extender = new VisualStudioToolStripExtender(); extender.SetStyle(menuMain, VisualStudioToolStripExtender.VsVersion.Vs2015, theme); - + InitialMenu(MenuFormFactory.MenuFrmTypeDict, ""); //MenuFormFactory.MenuFrmTypeDict.ToList().ForEach(t => @@ -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 @@ -491,15 +501,18 @@ private void Device_OnDeviceStateChanged(IDevice device, EnumHelper.DeviceState currentState) { - for (int i = 1; i < ststripDevices.Items.Count; i++) + ststripDevices.BeginInvoke(new Action(() => { - if ((ststripDevices.Items[i].Tag as IDevice)?.Id == device.Id) + for (int i = 1; i < ststripDevices.Items.Count; i++) { - ststripDevices.Items[i].BackColor = currentState.GetEnumSelectedColor(); - ststripDevices.Items[i].ForeColor = currentState.GetEnumSelectedFontColor(); - break; + if ((ststripDevices.Items[i].Tag as IDevice)?.Id == device.Id) + { + ststripDevices.Items[i].BackColor = currentState.GetEnumSelectedColor(); + ststripDevices.Items[i].ForeColor = currentState.GetEnumSelectedFontColor(); + break; + } } - } + })); } #endregion @@ -532,10 +545,10 @@ dockFrm.Text = desc[2]; - if (_process != null) - { - dockFrm.DownloadProcess(_process); - } + //if (_process != null) + //{ + // dockFrm.DownloadProcess(_process); + //} dockFrm.SetLoginStatus(IsLogin); @@ -570,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