From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 10 七月 2020 10:52:13 +0800
Subject: [PATCH] 2020-07-10-01

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs |  116 ++++++++++++++++++++++++++--------------------------------
 1 files changed, 52 insertions(+), 64 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
index 5122424..8d69a71 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/FunctionSetting.cs
@@ -1,29 +1,38 @@
 锘縰sing System;
 using System.Collections.Generic;
 using Shared.Common;
+using Shared.Phone.UserView;
 using ZigBee.Device;
 
 namespace Shared.Phone.UserCenter.DoorLock
 {
-    public class FunctionSetting : DoorLockCommonLayout, ZigBee.Common.IStatus
+    public class FunctionSetting : DoorLockCommonLayout
     {
-        #region 鈼� 鏋勯�犲嚱鏁癬_________________________
+        #region  鏋勯�犲嚱鏁� 
         /// <summary>
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="doorLock"></param>
-        public FunctionSetting(ZigBee.Device.DoorLock doorLock)
+        public FunctionSetting(Room room, CommonDevice doorLock)
         {
-            //闂��
-            this.doorLock = doorLock;
+            this.doorLock = doorLock as ZigBee.Device.DoorLock;
+            currentRoom = room;
+            deviceUI = doorLock;
             listNewDevice.Add(doorLock);
             BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
-            ZigBee.Device.ZbGateway.StatusList.Add(this);
         }
         #endregion
 
-        #region 鈼� 鍙橀噺鐢虫槑__________________________
+        #region  鍙橀噺鐢虫槑 
         public ZigBee.Device.DoorLock doorLock = null;
+        /// <summary>
+        /// 褰撳墠鎴块棿
+        /// </summary>
+        Room currentRoom;
+        /// <summary>
+        /// 璁惧UI瀵硅薄
+        /// </summary>
+        CommonDevice deviceUI;
         /// <summary>
         /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍚嶅瓧
         /// </summary>
@@ -53,7 +62,7 @@
         FrameLayout bottomFrameLayout;
         #endregion
 
-        #region 鈼� UI鏄剧ず __________________________ 
+        #region  UI鏄剧ず  
         /// <summary>
         /// UI鏄剧ず 
         /// </summary>
@@ -74,18 +83,15 @@
         }
         #endregion
 
-        #region 鈼� 涓儴鏄剧ず __________________________ 
+        #region  涓儴鏄剧ず  
         public void MidFrameLayoutContent()
         {
-            var MidTopFrameLayout = new FrameLayout()
-            {
-                X = Application.GetRealWidth(449),
-                Y = Application.GetRealHeight(58),
-                Width = Application.GetRealWidth(184),
-                Height = Application.GetRealHeight(184),
-                BackgroundImagePath = "DoorLock/DoorlockPicture.png",
-            };
-            this.midFrameLayout.AddChidren(MidTopFrameLayout);
+            //鍥剧墖
+            var btnPic = new DeviceInfoIconControl();
+            btnPic.Y = Application.GetRealHeight(92);
+            btnPic.Gravity = Gravity.CenterHorizontal;
+            this.midFrameLayout.AddChidren(btnPic);
+            btnPic.InitControl(doorLock);
 
             var btnDeviceText = new Button()
             {
@@ -102,7 +108,7 @@
         }
         #endregion
 
-        #region 鈼� 搴曢儴鏄剧ず __________________________  
+        #region  搴曢儴鏄剧ず 
         public void BottomFrameLayout()
         {
             #region  UI 
@@ -133,13 +139,13 @@
                 Y = Application.GetRealHeight(170),
             };
             bottomFrameLayout.AddChidren(listview);
-            #endregion 
+            #endregion
 
             FunctionDetail(doorLock);
         }
         #endregion
 
-        #region 鈼� 鍔熻兘鏄剧ず __________________________ 
+        #region  鍔熻兘鏄剧ず  
         void FunctionDetail(ZigBee.Device.DoorLock doorLock)
         {
             listview.RemoveAll();
@@ -175,20 +181,28 @@
             var listCheck = new List<string>();
             rowBeloneArea.SelectRoomEvent += (roomKeys) =>
             {
+                //閫夋嫨鏈垎閰嶆椂,娓呯┖
+                if (roomKeys == string.Empty) { listCheck = new List<string>(); }
                 foreach (var device in this.listNewDevice)
-                {
-                    var room = Room.CurrentRoom.GetRoomByDevice(device);
+                {
+                    if (roomKeys == string.Empty)
+                    {
+                        //濡傛灉閫夋嫨鐨勬槸鏈垎閰嶏紝鍒欏畠鐨勫叏閮ㄥ洖璺棤鏉′欢鍏ㄩ儴娓呯┖鎴块棿
+                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
+                        continue;
+                    }
+                    var room = HdlRoomLogic.Current.GetRoomByDevice(device);
                     string mainKeys = LocalDevice.Current.GetDeviceMainKeys(device);
                     if (room == null)
                     {
                         //杩欓噷鏈夌偣鐗规畩,濡傛灉鍥炶矾娌℃湁璁剧疆鏈夊尯鍩熺殑鏃跺��,鎵嶈缃�
                         listCheck.Add(mainKeys);
-                        Room.CurrentRoom.ChangedRoom(device, roomKeys);
+                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
                     }
                     else if (listCheck.Contains(mainKeys) == true)
                     {
                         //濡傛灉杩欎釜鍥炶矾涔嬪墠閮借繕娌℃湁鍖哄煙,鍦ㄦ湰鐣岄潰杩樻病鏈夊叧闂箣鍓�,鍙互鏃犳潯浠堕殢渚垮彉鏇�
-                        Room.CurrentRoom.ChangedRoom(device, roomKeys);
+                        HdlRoomLogic.Current.ChangedRoom(device, roomKeys);
                     }
                 }
                 //淇濆瓨璁惧鎴块棿绱㈠紩
@@ -196,7 +210,7 @@
             };
 
             //璁惧妯″潡
-            caption = Language.StringByID(R.MyInternationalizationString.BelongModel);
+            caption = Language.StringByID(R.MyInternationalizationString.BelongDevice);
             deviceName = Common.LocalDevice.Current.GetDeviceObjectText(listNewDevice);
             var btnType = new FrameCaptionViewControl(caption, deviceName, listview.rowSpace / 2);
             btnType.UseClickStatu = false;
@@ -234,7 +248,7 @@
         }
         #endregion
 
-        #region 娣诲姞鍏ㄩ儴鑿滃崟
+        #region  娣诲姞鍏ㄩ儴鑿滃崟 
         /// <summary>
         /// 娣诲姞鍏ㄩ儴鑿滃崟
         /// </summary>
@@ -283,7 +297,7 @@
                 };
                 actionNone = async () =>
                 {
-                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action);
+                    Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock);
                 };
                 HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone);
             };
@@ -407,19 +421,19 @@
 
         #endregion
 
-        #region 鈼� 璁惧閲嶅懡鍚峗_________________________
+        #region  璁惧閲嶅懡鍚� 
         /// <summary>
         /// 璁惧閲嶅懡鍚�
         /// </summary>
         /// <param name="i_deviceName">deviceName.</param>
-        private async void DeviceReName(string i_deviceName, bool closeForm)
+        private void DeviceReName(string i_deviceName, bool closeForm)
         {
             //寮�鍚繘搴︽潯
             this.ShowProgressBar();
 
             //淇敼MAC鍚�
             string deviceName = i_deviceName.Trim();
-            var result = await Common.LocalDevice.Current.ReMacName(listNewDevice, deviceName);
+            var result = Common.LocalDevice.Current.ReMacName(listNewDevice, deviceName);
             //鍏抽棴杩涘害鏉�
             this.CloseProgressBar();
 
@@ -448,60 +462,34 @@
         }
         #endregion
 
-        #region 鈼� 琛屾暟瓒呰繃瀹瑰櫒鏃讹紝琛ヤ竴涓┖鐧紽rameLayout__________________________
+        #region  琛屾暟瓒呰繃瀹瑰櫒鏃讹紝琛ヤ竴涓┖鐧紽rameLayout 
         /// <summary>
         /// 琛屾暟瓒呰繃瀹瑰櫒鏃讹紝琛ヤ竴涓┖鐧紽rameLayout锛屼娇涔嬭兘婊戝姩
         /// </summary> 
         void FinishInitControl(FrameLayout bodyFrameLayout, VerticalListControl listview)
         {
-            var btnFinish = new BottomClickButton();
-            btnFinish.Y = Application.GetRealHeight(1054);
             if (listview.ChildrenCount > 0)
             {
                 var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount;
 
-                if (bodyFrameLayout.Height - btnFinish.Y + realHeight > listview.Height)
+                if (bodyFrameLayout.Height - Application.GetRealHeight(1054) + realHeight > listview.Height)
                 {
                     //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩
                     var frameTemp = new FrameLayout();
-                    frameTemp.Height = bodyFrameLayout.Height - btnFinish.Y + Application.GetRealHeight(115);
+                    frameTemp.Height = bodyFrameLayout.Height - Application.GetRealHeight(1054) + Application.GetRealHeight(115);
                     listview.AddChidren(frameTemp);
                 }
             }
         }
         #endregion
 
-        #region 鈼� 鎺ュ彛瀹炵幇__________________________
+        #region 绉婚櫎鏂规硶
         /// <summary>
-        /// 澶勭悊鍙樺寲浜嬩欢 --灏嗗純鐢� 鏀圭敤DeviceInfoChange()
+        /// 閲嶅啓绉婚櫎鏂规硶
         /// </summary>
-        /// <returns>The changed.</returns>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
+        public override void RemoveFromParent()
         {
-
-        }
-        /// <summary>
-        /// 澶勭悊鍙樺寲浜嬩欢
-        /// </summary>
-        /// <param name="common"></param>
-        /// <param name="typeTag"></param>
-        public void DeviceInfoChange(CommonDevice common, string typeTag)
-        {
-        }
-        /// <summary>
-        /// Changeds the IL ogic status.
-        /// </summary>
-        /// <param name="logic">Logic.</param>
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-        }
-        /// <summary>
-        /// Changeds the IS cene status.
-        /// </summary>
-        /// <param name="scene">Scene.</param>
-        public void ChangedISceneStatus(Scene scene)
-        {
+            base.RemoveFromParent();
         }
         #endregion
     }

--
Gitblit v1.8.0