From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 九月 2019 13:22:40 +0800
Subject: [PATCH] 合并了徐梅的按键面板绑定

---
 ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs |   58 +++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 39 insertions(+), 19 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs
index 9b19b27..ecd826a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DeviceShard/ShardDeviceManagementMainForm.cs
@@ -53,8 +53,8 @@
         /// </summary>
         public void InitMiddleFrame()
         {
-            //绉婚櫎鍏ㄩ儴
-            bodyFrameLayout.RemoveAll();
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
 
             //鍒濆鍖栨悳绱㈡帶浠�
             this.InitSearchControl();
@@ -111,8 +111,11 @@
             {
                 Application.RunOnMainThread(() =>
                 {
-                    //鍦ㄧ晫闈腑闂存樉绀烘棤鍒嗕韩璁惧鐨勬彁绀烘秷鎭�
-                    this.ShowNotShardDeviceMsg();
+                    if (this.Parent != null)
+                    {
+                        //鍦ㄧ晫闈腑闂存樉绀烘棤鍒嗕韩璁惧鐨勬彁绀烘秷鎭�
+                        this.ShowNotShardDeviceMsg();
+                    }
                 });
             }
             else
@@ -138,6 +141,10 @@
             {
                 Application.RunOnMainThread(() =>
                 {
+                    if (this.Parent == null)
+                    {
+                        return;
+                    }
                     count++;
                     //娣诲姞璁惧鐨勮彍鍗曡
                     this.AddDeviceMenuRow(rowInfo.listDevice);
@@ -380,8 +387,11 @@
                     {
                         Application.RunOnMainThread(() =>
                         {
-                            //娣诲姞璁惧鐨勮
-                            this.AddDeviceMenuRow(rowInfo.listDevice);
+                            if (this.Parent != null)
+                            {
+                                //娣诲姞璁惧鐨勮
+                                this.AddDeviceMenuRow(rowInfo.listDevice);
+                            }
                         });
                     }
                 }
@@ -395,8 +405,11 @@
                         {
                             Application.RunOnMainThread(() =>
                             {
-                                //娣诲姞璁惧鐨勮
-                                this.AddDeviceMenuRow(rowInfo.listDevice);
+                                if (this.Parent != null)
+                                {
+                                    //娣诲姞璁惧鐨勮
+                                    this.AddDeviceMenuRow(rowInfo.listDevice);
+                                }
                             });
                         }
                     }
@@ -471,7 +484,7 @@
         private void StartCheckDeviceOnline()
         {
             //娣诲姞鎺ュ彈缃戝叧鑷姩鎺ㄩ�佺殑浜嬩欢
-            DeviceAttributeLogic.Current.AddReceiveDeviceOnlinePushEvent("DeviceListFormReceivePushOnline", this.ReceiveDeviceStatuPush);
+            HdlDeviceAttributeLogic.Current.AddReceiveDeviceOnlinePushEvent("DeviceListFormReceivePushOnline", this.ReceiveDeviceStatuPush);
 
             //浠庤澶囧垪琛ㄤ腑鑾峰彇鍦ㄧ嚎鐘舵��
             new System.Threading.Thread(async () =>
@@ -540,7 +553,7 @@
 
                 Application.RunOnMainThread(() =>
                 {
-                    row.SetOnlineStatu(device.IsOnline == 1);
+                    row?.SetOnlineStatu(device.IsOnline == 1);
                 });
             }
         }
@@ -554,7 +567,7 @@
         /// </summary>
         private void StartCheckDeviceAlarm()
         {
-            DeviceAttributeLogic.Current.AddSafetyAlarmEvent("DeviceListFormSensor", this.SetAlarmInfoByInterfaceResult);
+            HdlDeviceAttributeLogic.Current.AddSafetyAlarmEvent("DeviceListFormSensor", this.SetAlarmInfoByInterfaceResult);
         }
 
         /// <summary>
@@ -584,7 +597,7 @@
                 }
                 Application.RunOnMainThread(() =>
                 {
-                    row.StartSelectStatuThread(3000);
+                    row?.StartSelectStatuThread(3000);
                 });
             }
         }
@@ -620,6 +633,14 @@
                 //鏀堕泦妫�绱㈢敤鐨勪俊鎭�
                 foreach (var rowInfo in this.dicRowInfo.Values)
                 {
+                    rowInfo.listDevice.Sort((CommonDevice device1, CommonDevice device2) =>
+                    {
+                        if (device1.DeviceEpoint > device2.DeviceEpoint)
+                        {
+                            return 1;
+                        }
+                        return -1;
+                    });
                     rowInfo.MacName = Common.LocalDevice.Current.GetDeviceMacName(rowInfo.listDevice[0]);
                     rowInfo.DeviveTypeName = Common.LocalDevice.Current.GetDeviceObjectText(rowInfo.listDevice);
                 }
@@ -648,7 +669,7 @@
         /// </summary>
         public void OpenGatewayManagementForm()
         {
-            var form = new Gateway.GatewayManagementForm();
+            var form = new GatewayManage.GatewayManagementForm();
             this.AddForm(form);
         }
 
@@ -673,14 +694,13 @@
 
         /// <summary>
         /// 鐢婚潰鍏抽棴
-        /// </summary>
-        /// <param name="isCloseForm">鏄惁鍏抽棴鐣岄潰,false鐨勬椂鍊�,鍙細璋冪敤鍏抽棴鍑芥暟閲岄潰鐨勯檮鍔犲姛鑳�</param>
-        public override void CloseForm(bool isCloseForm = true)
+        /// </summary>
+        public override void CloseForm()
         {
-            DeviceAttributeLogic.Current.RemoveEvent("DeviceListFormSensor");
-            DeviceAttributeLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline");
+            HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormSensor");
+            HdlDeviceAttributeLogic.Current.RemoveEvent("DeviceListFormReceivePushOnline");
 
-            base.CloseForm(isCloseForm);
+            base.CloseForm();
         }
 
         #endregion

--
Gitblit v1.8.0