From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs |  280 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 140 insertions(+), 140 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs
index 75c888f..ea700d3 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/SafetyManagementMainForm.cs
@@ -1,21 +1,21 @@
-锘縰sing System;
+锘縰sing System;
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using ZigBee.Device;
 
-namespace Shared.Phone.UserCenter.Safety
-{
-    /// <summary>
-    /// 瀹夐槻绠$悊鐨勪富鐣岄潰鈽�
-    /// </summary>
-    public class SafetyManagementMainForm : EditorCommonForm
+namespace Shared.Phone.UserCenter.Safety
+{
+    /// <summary>
+    /// 瀹夐槻绠$悊鐨勪富鐣岄潰鈽�
+    /// </summary>
+    public class SafetyManagementMainForm : EditorCommonForm
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
         /// <summary>
         /// 妗屽竷鎺т欢锛岀敤浜庡瓨鏀炬垨鑰呯Щ闄ゅ姛鑳藉潡鎺т欢(Tab鎺т欢涓撶敤)
         /// </summary>
-        private FrameLayout frameLayoutDraw = null;
+        private NormalFrameLayout frameLayoutDraw = null;
         /// <summary>
         /// 瀹夐槻鎺т欢
         /// </summary>
@@ -65,64 +65,80 @@
         /// </summary>
         private void InitTabSwitchControl()
         {
-            //妗屽竷鎺т欢
-            frameLayoutDraw = new FrameLayout();
-            frameLayoutDraw.Y = Application.GetRealHeight(590);
-            frameLayoutDraw.Height = bodyFrameLayout.Height - Application.GetRealHeight(590);
-            bodyFrameLayout.AddChidren(frameLayoutDraw);
+            var frameBack = new FrameLayout();
+            frameBack.Height = Application.GetRealHeight(1300);
+            frameBack.Y = Application.GetRealHeight(444);
+            frameBack.BackgroundColor = 0xa1ffffff;
+            frameBack.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
+            bodyFrameLayout.AddChidren(frameBack);
 
-            //涓存椂鐨勪竴涓笢瑗�,鐢ㄦ潵璁$畻鐪熷疄鍊艰�屽凡
-            var btnTemp = new NormalViewControl(100, false);
-            int realLogWidth = btnTemp.GetRealWidthByText(16, Language.StringByID(R.MyInternationalizationString.uSecurityLog));
-            int realSensorWidth = btnTemp.GetRealWidthByText(16, Language.StringByID(R.MyInternationalizationString.uSensorStatu));
-            btnTemp = null;
+            //妗屽竷鎺т欢
+            frameLayoutDraw = new NormalFrameLayout();
+            frameLayoutDraw.Y = Application.GetRealHeight(181);
+            frameLayoutDraw.Height = frameBack.Height - Application.GetRealHeight(181);
+            frameBack.AddChidren(frameLayoutDraw);
+
+            //璁$畻瀹藉害浣跨敤
+            var btnTemp = new ButtonBase();
+            btnTemp.TextSize = 16;
+            btnTemp.IsBold = true;
+
+            btnTemp.TextID = R.MyInternationalizationString.uSecurityLog;
+            int frameLogWidth = btnTemp.GetRealWidthByText() + Application.GetRealWidth(30);
+
+            btnTemp.TextID = R.MyInternationalizationString.uSensorStatu;
+            int frameSensorWidth = btnTemp.GetRealWidthByText() + Application.GetRealWidth(30);
 
             //瀹夐槻璁板綍(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�)
-            var frameLog = new FrameLayoutControl();
+            var frameLog = new FrameLayoutStatuControl();
             frameLog.UseClickStatu = false;
             frameLog.Height = Application.GetRealHeight(123);
-            frameLog.Width = realLogWidth;
-            frameLog.X = Application.GetRealWidth(489) - realLogWidth;
-            frameLog.Y = Application.GetRealHeight(467);
-            bodyFrameLayout.AddChidren(frameLog);
+            frameLog.Width = frameLogWidth;
+            frameLog.X = (frameBack.Width - frameLogWidth - frameSensorWidth) / 2;
+            frameLog.Y = Application.GetRealHeight(58);
+            frameBack.AddChidren(frameLog);
             //鏍囬
             var btnLog = new NormalViewControl(100, 63, true);
-            btnLog.Width = realLogWidth;
-            btnLog.TextAlignment = TextAlignment.CenterRight;
+            btnLog.Width = frameLog.Width;
+            btnLog.TextAlignment = TextAlignment.Center;
             btnLog.TextID = R.MyInternationalizationString.uSecurityLog;
             btnLog.TextColor = UserCenterColor.Current.TextGrayColor3;
-            frameLog.AddChidren(btnLog, ChidrenBindMode.BindEventOnly);
+            frameLog.AddChidren(btnLog, ChidrenBindMode.BindEvent);
             //搴曠嚎
             var btnLogLine = new NormalViewControl(40, 10, true);
             btnLogLine.Y = Application.GetRealHeight(86);
-            btnLogLine.X = btnLog.X + btnLog.Width / 2 - Application.GetRealWidth(40) / 2;
+            //btnLogLine.X = btnLog.X + btnLog.Width / 2 - Application.GetRealWidth(40) / 2;
+            btnLogLine.Gravity = Gravity.CenterHorizontal;
             btnLogLine.Radius = (uint)Application.GetRealHeight(10) / 2;
             btnLogLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
-            frameLog.AddChidren(btnLogLine, ChidrenBindMode.BindEventOnly);
+            frameLog.AddChidren(btnLogLine, ChidrenBindMode.BindEvent);
             btnLogLine.Visible = false;
 
             //浼犳劅鍣ㄧ姸鎬�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�)
-            var frameSensor = new FrameLayoutControl();
+            var frameSensor = new FrameLayoutStatuControl();
             frameSensor.UseClickStatu = false;
             frameSensor.Height = frameLog.Height;
-            frameSensor.Width = realSensorWidth;
-            frameSensor.X = Application.GetRealWidth(550);
+            frameSensor.Width = frameSensorWidth;
+            frameSensor.X = frameLog.Right;
             frameSensor.Y = frameLog.Y;
-            bodyFrameLayout.AddChidren(frameSensor);
+            frameBack.AddChidren(frameSensor);
             //鏍囬
             var btnSensor = new NormalViewControl(100, 63, true);
-            btnSensor.Width = realSensorWidth;
+            btnSensor.Width = frameSensor.Width;
             btnSensor.TextID = R.MyInternationalizationString.uSensorStatu;
             btnSensor.TextSize = 16;
+            btnSensor.TextAlignment = TextAlignment.Center;
             btnSensor.TextColor = UserCenterColor.Current.TextColor2;
-            frameSensor.AddChidren(btnSensor, ChidrenBindMode.BindEventOnly);
+            btnSensor.IsBold = true;
+            frameSensor.AddChidren(btnSensor, ChidrenBindMode.BindEvent);
             //搴曠嚎
             var btnSensorLine = new NormalViewControl(40, 10, true);
             btnSensorLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
             btnSensorLine.Y = btnLogLine.Y;
-            btnSensorLine.X = btnSensor.X + btnSensor.Width / 2 - Application.GetRealWidth(40) / 2;
+            //btnSensorLine.X = btnSensor.X + btnSensor.Width / 2 - Application.GetRealWidth(40) / 2;
+            btnSensorLine.Gravity = Gravity.CenterHorizontal;
             btnSensorLine.Radius = (uint)Application.GetRealHeight(10) / 2;
-            frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEventOnly);
+            frameSensor.AddChidren(btnSensorLine, ChidrenBindMode.BindEvent);
 
             //瀹夐槻璁板綍Tab
             frameLog.ButtonClickEvent += (sender, e) =>
@@ -130,8 +146,10 @@
                 //瀛椾綋澶у皬鍜岄鑹插彉鏇�
                 btnSensor.TextColor = UserCenterColor.Current.TextGrayColor3;
                 btnSensor.TextSize = 14;
+                btnSensor.IsBold = false;
                 btnLog.TextColor = UserCenterColor.Current.TextColor2;
                 btnLog.TextSize = 16;
+                btnLog.IsBold = true;
 
                 btnLogLine.Visible = true;
                 btnSensorLine.Visible = false;
@@ -148,8 +166,10 @@
                 //瀛椾綋澶у皬鍜岄鑹插彉鏇�
                 btnSensor.TextColor = UserCenterColor.Current.TextColor2;
                 btnSensor.TextSize = 16;
+                btnSensor.IsBold = true;
                 btnLog.TextColor = UserCenterColor.Current.TextGrayColor3;
                 btnLog.TextSize = 14;
+                btnLog.IsBold = false;
 
                 btnLogLine.Visible = false;
                 btnSensorLine.Visible = true;
@@ -183,7 +203,7 @@
                 btnIcon.ButtonClickEvent += (sender, e) =>
                 {
                     //鑿滃崟鎺т欢
-                    var frameMenu = new TopRightMenuControl(2);
+                    var frameMenu = new TopRightMenuControl(2, 2);
                     //闃插尯鍒楄〃
                     string menu1 = Language.StringByID(R.MyInternationalizationString.uGarrisonAreaList);
                     frameMenu.AddRowMenu(menu1, "Item/GarrisonList.png", "Item/GarrisonListSelected.png", () =>
@@ -231,7 +251,7 @@
 
             topFrameLayout.AddChidren(btnShortCut);
             btnShortCut.InitControl();
-            if (UserCenterResourse.Option.SafetyShortcut == true)
+            if (UserCenterResourse.ResidenceOption.SafetyShortcut == true)
             {
                 //浣跨敤蹇嵎鏂瑰紡
                 btnShortCut.IsSelected = true;
@@ -243,9 +263,11 @@
                     //纭畾鍙栨秷涓婚〉鐨勩�屽畨闃层�嶆嵎寰勶紵
                     this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uCancelSafetyShortcutMsg), () =>
                     {
-                        UserCenterResourse.Option.SafetyShortcut = false;
-                        UserCenterResourse.Option.Save();
+                        UserCenterResourse.ResidenceOption.SafetyShortcut = false;
+                        UserCenterResourse.ResidenceOption.Save();
                         btnShortCut.IsSelected = false;
+                        //鍙栨秷涓婚〉鐨勩�屽畨闃层�嶆嵎寰勭殑璇�,涓婚〉闇�瑕侀噸鏂板埛鏂�
+                        UserView.UserPage.Instance.RefreshAllForm = true;
                     });
                 }
                 else
@@ -253,9 +275,11 @@
                     //纭畾鍒涘缓銆屽畨闃层�嶆嵎寰勫埌涓婚〉锛�
                     this.ShowMassage(ShowMsgType.Confirm, Language.StringByID(R.MyInternationalizationString.uCreatSafetyShortcutMsg), () =>
                     {
-                        UserCenterResourse.Option.SafetyShortcut = true;
-                        UserCenterResourse.Option.Save();
+                        UserCenterResourse.ResidenceOption.SafetyShortcut = true;
+                        UserCenterResourse.ResidenceOption.Save();
                         btnShortCut.IsSelected = true;
+                        //鍒涘缓涓婚〉鐨勩�屽畨闃层�嶆嵎寰勭殑璇�,涓婚〉闇�瑕侀噸鏂板埛鏂�
+                        UserView.UserPage.Instance.RefreshAllForm = true;
                     });
                 }
             };
@@ -304,7 +328,7 @@
             this.CloseProgressBar();
 
             //鏁版嵁鍒濆鍖栧畬鎴愬悗
-            Application.RunOnMainThread(() =>
+            HdlThreadLogic.Current.RunMain(() =>
             {
                 //鍒濆鍖栧ご閮ㄧ殑閭d笁涓浘鏍�
                 garrisonControl = new SafetyMasterControl();
@@ -346,12 +370,12 @@
         /// <summary>
         /// 鐢婚潰鍏抽棴
         /// </summary>
-        public override void CloseForm()
+        public override void CloseFormBefore()
         {
             //绉婚櫎鍏ㄩ儴鐩戝惉浜嬩欢
             this.RemoveAllListenEvent();
 
-            base.CloseForm();
+            base.CloseFormBefore();
         }
 
         /// <summary>
@@ -359,8 +383,8 @@
         /// </summary>
         private void RemoveAllListenEvent()
         {
-            HdlDeviceAttributeLogic.Current.RemoveEvent("SafetyManagementMainFormAlarm");
-            HdlDeviceAttributeLogic.Current.RemoveEvent("SafetyManagementMainFormReceivePushOnline");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("SafetyManagementMainFormAlarm");
+            HdlGatewayReceiveLogic.Current.RemoveEvent("SafetyManagementMainFormReceivePushOnline");
         }
 
         #endregion
@@ -400,9 +424,9 @@
                 var dicDevice = HdlSafeguardLogic.Current.GetAllSensorDeviceInfo();
                 var listDevice = new List<CommonDevice>();
 
-                foreach (var zoneId in dicDevice.Keys)
+                HdlThreadLogic.Current.RunMain(() =>
                 {
-                    Application.RunOnMainThread(() =>
+                    foreach (var zoneId in dicDevice.Keys)
                     {
                         foreach (var Info in dicDevice[zoneId])
                         {
@@ -420,17 +444,14 @@
                                 listDevice.Add(tempDevice);
                             }
                         }
-                        //鏈�鍚庝竴涓槻鍖虹殑鏃跺�欙紝寮�鍚悇绉嶇洃瑙嗙嚎绋�
-                        if (zoneId == dicDevice.Count)
-                        {
-                            //寮�鍚紶鎰熷櫒鎶ヨ鐩戣
-                            this.StartCheckDeviceAlarm();
-
-                            //寮�鍚澶囧湪绾跨洃娴�
-                            this.StartCheckDeviceOnline(listDevice);
-                        }
-                    });
-                }
+                    }
+                    //璋冩暣鍒楄〃鎺т欢楂樺害
+                    listView.AdjustChidrenFrameHeight(listView.frameTable, Application.GetRealHeight(46));
+                    //寮�鍚紶鎰熷櫒鎶ヨ鐩戣
+                    this.StartCheckDeviceAlarm();
+                    //寮�鍚澶囧湪绾跨洃娴�
+                    this.StartCheckDeviceOnline(listDevice);
+                });
             });
         }
 
@@ -450,8 +471,10 @@
 
             //鑷畾涔変紶鎰熷櫒鐘舵�佹帶浠�
             var frameDevice = new SafetySensorStatuControl();
-            listView.AddChidrenFrame(frameDevice);
+            listView.AddChidren(frameDevice);
             frameDevice.InitControl(device);
+            //娣诲姞闃村奖鐗规晥
+            frameDevice.SetViewShadow(true);
 
             string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
             this.dicSensorStatuView[mainkeys] = frameDevice;
@@ -467,15 +490,13 @@
         private void StartCheckDeviceAlarm()
         {
             //鏍规嵁鎺ュ彛鎺ㄩ�侊紝璁剧疆鎶ヨ淇℃伅
-            HdlDeviceAttributeLogic.Current.AddAttributeEvent("SafetyManagementMainFormAlarm", "IASInfoReport", (device) =>
+            HdlGatewayReceiveLogic.Current.AddAttributeEvent("SafetyManagementMainFormAlarm", ReceiveComandDiv.A浼犳劅鍣ㄤ笂鎶�, (device) =>
             {
                 if (HdlSafeguardLogic.Current.IsSensorDeviceExist(device) == false)
                 {
                     //濡傛灉杩欎釜璁惧涓嶅瓨鍦ㄤ簬瀹夐槻锛屽垯涓嶅鐞�
                     return;
                 }
-                //娣诲姞瀹夐槻璁惧涓婃姤鐨勮鎺т欢
-                this.AddSafeguardLogPushRow(device);
 
                 //浼犳劅鍣ㄧ姸鎬�
                 string mainkey = Common.LocalDevice.Current.GetDeviceMainKeys(device);
@@ -486,7 +507,7 @@
                 var control = this.dicSensorStatuView[mainkey];
                 //鑾峰彇浼犳劅鍣ㄦ姤璀︿俊鎭殑缈昏瘧鏂囨湰
                 var msgInfo = HdlAlarmsLogic.Current.GetSensorAlarmInfo(device);
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
                     control?.SetSensoReportInfo(msgInfo);
                 });
@@ -526,69 +547,59 @@
             //浠庤澶囧垪琛ㄤ腑鑾峰彇鍦ㄧ嚎鐘舵��
             HdlThreadLogic.Current.RunThread(() =>
             {
-                //棣栧厛鑾峰彇杩欎簺浼犳劅鍣ㄦ墍鍦ㄧ殑缃戝叧
-                var listWay = new List<ZbGateway>();
                 foreach (var device in listDevice)
-                {
-                    ZbGateway realWay = null;
-                    //鏄惁瀛樺湪鐪熷疄鐗╃悊缃戝叧
-                    if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, device.CurrentGateWayId) == false)
-                    {
-                        continue;
-                    }
-                    listWay.Add(realWay);
-                }
-                foreach (var zbway in listWay)
                 {
                     if (this.Parent == null)
                     {
                         //鐣岄潰鍏抽棴
                         return;
                     }
-                    Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, this.ReceiveDeviceStatuPush, ShowErrorMode.NO);
+                    var deviceInfo = Common.LocalDevice.Current.ReadDeviceEpointDeviceInfo(device);
+                    if (deviceInfo != null)
+                    {
+                        //璁剧疆璁惧鍦ㄧ嚎鐘舵��
+                        this.ReceiveDeviceStatuPush(device, deviceInfo);
+                    }
+                    System.Threading.Thread.Sleep(50);
                 }
-            });
+            }, ShowErrorMode.NO);
         }
 
         /// <summary>
         /// 鎺ュ彈璁惧鍦ㄧ嚎鎺ㄩ��
         /// </summary>
         /// <param name="device"></param>
-        private void ReceiveDeviceStatuPush(CommonDevice device)
+        private void ReceiveDeviceStatuPush(CommonDevice device, CommonDevice.DeviceInfoData deviceInfo)
         {
             if (this.Parent == null)
             {
                 //鐣岄潰鍏抽棴
                 return;
             }
-
-            lock (objOnlineLock)
+            string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
+            if (this.dicSensorStatuView.ContainsKey(mainkeys) == true)
             {
-                string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
-                if (this.dicSensorStatuView.ContainsKey(mainkeys) == true)
+                CommonDevice Loacldevice = Common.LocalDevice.Current.GetDevice(mainkeys);
+                if (Loacldevice == null)
                 {
-                    CommonDevice Loacldevice = Common.LocalDevice.Current.GetDevice(mainkeys);
-                    if (Loacldevice == null)
-                    {
-                        return;
-                    }
-                    //鍦ㄧ嚎鐘舵�佷竴鏍风殑璇濓紝涓嶉渶瑕佸埛鏂�
-                    if (Loacldevice.IsOnline == device.IsOnline)
-                    {
-                        return;
-                    }
-                    //淇濆瓨鐘舵��
-                    Loacldevice.IsOnline = device.IsOnline;
-                    Loacldevice.ReSave();
-
-                    //鍥犱负杩欐槸鎺ㄩ�佽繃鏉ョ殑锛屾垜涓嶄繚璇侀偅涓�鐬棿杩欎釜涓滆タ浼氫笉浼氳绉婚櫎
-                    var control = this.dicSensorStatuView[mainkeys];
-                    Application.RunOnMainThread(() =>
-                    {
-                        //璁剧疆鎺т欢鐨勫湪绾跨姸鎬佹枃鏈晥鏋�
-                        control?.SetOnlineStatu(device.IsOnline == 1);
-                    });
+                    return;
                 }
+                //鍦ㄧ嚎鐘舵�佷竴鏍风殑璇濓紝涓嶉渶瑕佸埛鏂�
+                if (Loacldevice.IsOnline == deviceInfo.IsOnline)
+                {
+                    return;
+                }
+                //淇濆瓨鐘舵��
+                Loacldevice.IsOnline = deviceInfo.IsOnline;
+
+                //鍥犱负杩欐槸鎺ㄩ�佽繃鏉ョ殑锛屾垜涓嶄繚璇侀偅涓�鐬棿杩欎釜涓滆タ浼氫笉浼氳绉婚櫎
+                var control = this.dicSensorStatuView[mainkeys];
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //璁剧疆鎺т欢鐨勫湪绾跨姸鎬佹枃鏈晥鏋�
+                    bool bolOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(device);
+                    control?.SetOnlineStatu(bolOnline);
+                });
             }
         }
 
@@ -622,7 +633,7 @@
             this.dicSensorStatuView.Clear();
 
             frameLayoutDraw.RemoveAll();
-            var listView = new VerticalFrameControl(35);
+            var listView = new VerticalFrameControl(0);
             listView.Height = frameLayoutDraw.Height;
             frameLayoutDraw.AddChidren(listView);
 
@@ -654,7 +665,7 @@
                 }
                 dicAlarm = null;
 
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
                     if (this.Parent == null)
                     {
@@ -671,7 +682,8 @@
                     }
                     //鎵ц鍒濆鍖�
                     TodaySafeguardFrame = new SafeguardLogControl();
-                    listView.AddChidrenFrame(TodaySafeguardFrame);
+                    TodaySafeguardFrame.Y = Application.GetRealHeight(10);
+                    listView.AddChidren(TodaySafeguardFrame);
                     TodaySafeguardFrame.InitControl(nowDayKey, nowDayData);
 
                     //鍒濆鍖栧叾浠栨棩鏈熺殑瀹夐槻璁板綍鎺т欢
@@ -679,7 +691,7 @@
                     {
                         otherDaySafeguardFrame = new FrameLayout();
                         otherDaySafeguardFrame.Height = Application.GetRealHeight(10);
-                        listView.AddChidrenFrame(otherDaySafeguardFrame);
+                        listView.AddChidren(otherDaySafeguardFrame);
                         foreach (var dayText in dicInfo.Keys)
                         {
                             //鎵ц鍒濆鍖�
@@ -705,38 +717,14 @@
         /// <summary>
         /// 娣诲姞瀹夐槻璁惧涓婃姤鐨勮鎺т欢(瀹夐槻鎺ㄩ�佷細璋冪敤杩欎釜涓滆タ)
         /// </summary>
-        /// <param name="device">璁惧瀵硅薄锛屼负null鏃舵槸甯冮槻</param>
+        /// <param name="device">璁惧瀵硅薄</param>
         public void AddSafeguardLogPushRow(CommonDevice device)
         {
-            if (device == null && HdlSafeguardLogic.Current.listAlarmInfo.Count > 0)
-            {
-                //濡傛灉鏄畨闃叉帹閫佺殑璇濓紝澶翠笂闈㈢殑閭d笁涓渾鍦堢殑鍥炬爣瑕佹敼鍙�
-                Application.RunOnMainThread(() =>
-                {
-                    var infoTemp = HdlSafeguardLogic.Current.listAlarmInfo[0];
-                    if (infoTemp.AlarmType == SafeguardAlarmType.AtHome)
-                    {
-                        garrisonControl?.SetIconStatuByGarrisonMode(GarrisonMode.AtHome);
-                        this.ShowMassage(ShowMsgType.Tip, infoTemp.AlarmMsg);
-                    }
-                    else if (infoTemp.AlarmType == SafeguardAlarmType.RemoveHome)
-                    {
-                        garrisonControl?.SetIconStatuByGarrisonMode(GarrisonMode.RemoveHome);
-                        this.ShowMassage(ShowMsgType.Tip, infoTemp.AlarmMsg);
-                    }
-                    else if (infoTemp.AlarmType == SafeguardAlarmType.RemoveGarrison)
-                    {
-                        garrisonControl?.SetIconStatuByGarrisonMode(GarrisonMode.RemoveGarrison);
-                        this.ShowMassage(ShowMsgType.Tip, infoTemp.AlarmMsg);
-                    }
-                });
-                return;
-            }
-            if (this.TabSelectIndex != 1 || HdlSafeguardLogic.Current.listAlarmInfo.Count == 0)
+            if (this.TabSelectIndex != 1 || HdlAlarmsLogic.Current.listSafetyAlarmInfo.Count == 0)
             {
                 return;
             }
-            var info = HdlSafeguardLogic.Current.listAlarmInfo[0];
+            var info = HdlAlarmsLogic.Current.listSafetyAlarmInfo[0];
             if (device != null)
             {
                 string mainkey1 = Common.LocalDevice.Current.GetDeviceMainKeys(info.DeviceAddr, info.DeviceEpoint);
@@ -748,7 +736,7 @@
                 }
             }
 
-            Application.RunOnMainThread(() =>
+            HdlThreadLogic.Current.RunMain(() =>
             {
                 if (this.TodaySafeguardFrame != null)
                 {
@@ -769,6 +757,18 @@
                         listview?.AdjustTableHeight();
                     }
                 }
+            });
+        }
+
+        /// <summary>
+        /// 闃插尯鎺ㄩ��
+        /// </summary>
+        /// <param name="garrison"></param>
+        public void GarrisonModePush(GarrisonMode garrison)
+        {
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                garrisonControl?.SetIconStatuByGarrisonMode(garrison);
             });
         }
 
@@ -797,6 +797,6 @@
             return 1;
         }
 
-        #endregion
-    }
-}
+        #endregion
+    }
+}

--
Gitblit v1.8.0