From bd46c57c77c276014db3192a4e2cc96e23c93202 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 21 二月 2020 13:08:47 +0800
Subject: [PATCH] 先上传个版本吧

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs |   97 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 83 insertions(+), 14 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
index 2d29c23..06e29ea 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -26,26 +26,54 @@
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="doorLock"></param>
-        public AddScenePage(ZigBee.Device.Panel key)
+        public AddScenePage(ZigBee.Device.Panel key, List<ScenesListInfo> gwScenesList)
         {
             this.currentKey = key;
+            gwCurScenesList = gwScenesList;
         }
 
-        #region 鈼� 鍙橀噺鐢虫槑__________________________
+        #region  鍙橀噺鐢虫槑
+        /// <summary>
+        /// 褰撳墠鎸夐敭
+        /// </summary>
         ZigBee.Device.Panel currentKey;
-        //鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew
+        /// <summary>
+        /// 鏄剧ず琚粦瀹氳澶囨垨鍦烘櫙鐨剉iew
+        /// </summary>
         VerticalScrolViewLayout midVerticalScrolViewLayout;
+        /// <summary>
+        /// 鏄剧ず鎴块棿鐨剉iew
+        /// </summary>
         HorizontalScrolViewLayout btnHorizontalScrolViewLayout;
         /// <summary>
         /// 鎸夐敭閰嶇疆鐨勭洰鏍囧垪琛�
         /// </summary>
-        List<CommonDevice> targetList = new List<CommonDevice>();//涓存椂鐩爣鍒楄〃
-        List<Room> roomList = new List<Room>();//鏈湴鎴块棿鍒楄〃
+        List<CommonDevice> targetList = new List<CommonDevice>();
+        /// <summary>
+        /// 鏈湴鎴块棿鍒楄〃
+        /// </summary>
+        List<Room> roomList = new List<Room>();
+        /// <summary>
+        /// 褰撶粦瀹氳〃鍙樺寲鍚庣殑鍥炶皟
+        /// </summary>
         public Action<List<BindListResponseObj>> action;
+        /// <summary>
+        /// 淇濆瓨瀹屾垚鎸夐挳
+        /// </summary>
         Button btnFinifh;
+        /// <summary>
+        /// 妤煎眰鏂囨湰
+        /// </summary>
         Button btnFloorText;
-        Dictionary<string, string> dicFloor;//妤煎眰鍒楄〃
+        /// <summary>
+        /// 妤煎眰鍒楄〃
+        /// </summary>
+        Dictionary<string, string> dicFloor;
         List<SceneUI> currentKeyAllRoomSceneList = new List<SceneUI>();
+        /// <summary>
+        /// 缃戝叧涓殑鍦烘櫙鍒楄〃
+        /// </summary>
+        public List<ScenesListInfo> gwCurScenesList = new List<ScenesListInfo>();
         #endregion
 
         /// <summary>
@@ -76,7 +104,8 @@
                 X = Application.GetRealWidth(15),
                 Text = Language.StringByID(R.MyInternationalizationString.FirstFloor),
                 TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
-                TextSize = 15,
+                TextSize = 14,
+                IsBold = true,
                 TextAlignment = TextAlignment.CenterRight,
             };
             btnAddFrameLayout.AddChidren(btnFloorText);
@@ -105,6 +134,9 @@
             MidFrameLayoutContent(btnFloorText);
         }
 
+        /// <summary>
+        /// 涓儴甯冨眬
+        /// </summary>
         async void MidFrameLayoutContent(Button btnFloorText)
         {
             #region UI
@@ -143,6 +175,7 @@
                 TextID = R.MyInternationalizationString.Save,
                 BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                 TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
+                IsBold = true,
                 TextSize = 16,
             };
             bottomFrameLayout.AddChidren(btnFinifh);
@@ -201,7 +234,6 @@
             Shared.Common.Room curRoom = roomList[0];
             int index = 0;
             RefreshRoomList(curRoom, ref index);
-            //RefreshSceneList(roomList[index]);
 
             if (curRoom.SceneUIList.Count == 0)
             {
@@ -548,7 +580,10 @@
             RefreshSceneList(curRoom);
         }
 
-        //鎸夐敭缁戝畾鍦烘櫙琛ㄦ樉绀�
+        /// <summary>
+        /// 鎸夐敭缁戝畾鍦烘櫙琛ㄦ樉绀�
+        /// </summary>
+        /// <param name="curRoom"></param>
         void RefreshSceneList(Shared.Common.Room curRoom)
         {
             midVerticalScrolViewLayout.RemoveAll();
@@ -558,7 +593,14 @@
             }
             Button oldScene = null;
             int curIndex = 0;
-            foreach (var scene in curRoom.SceneUIList)
+            var currentSceneUIList = GetMatchSceneUIList(curRoom);
+            if (currentSceneUIList.Count == 0)
+            {
+                btnFinifh.Enable = false;
+                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+                return;
+            }
+            foreach (var scene in currentSceneUIList)
             {
                 #region 缁戝畾琛║I鏄撅紙鏃犳暟鎹鐞嗭級
                 var rowLayout = new FrameLayout()
@@ -580,10 +622,11 @@
 
                 var btnBindName = new Button()
                 {
-                    Width = Application.GetRealWidth(500 - 120),
+                    Width = Application.GetRealWidth(790),
                     X = devicePic.Right + Application.GetRealWidth(20),
                     TextColor = Shared.Common.ZigbeeColor.Current.TextBlack,
                     TextAlignment = TextAlignment.CenterLeft,
+                    TextSize = 15,
                 };
                 rowLayout.AddChidren(btnBindName);
 
@@ -710,7 +753,9 @@
             }
         }
 
-        // 渚ц竟瀵艰埅鏍�
+        /// <summary>
+        /// 妤煎眰閫夋嫨鐨勪晶杈瑰鑸爮
+        /// </summary>
         void SideslipFramelayout()
         {
             var dialog = new Dialog
@@ -741,8 +786,9 @@
                 Height = Application.GetRealHeight(58),
                 X = Application.GetRealWidth(81),
                 Y = Application.GetRealHeight(81),
-                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                 TextSize = 14,
+                IsBold = true,
                 TextAlignment = TextAlignment.CenterLeft,
                 TextID = R.MyInternationalizationString.SelectFloor,
             };
@@ -793,6 +839,7 @@
                 if (currentKey.currentSelectFloorId == floorId)
                 {
                     btnAllMethod.IsSelected = true;
+                    btnAllMethod.IsBold = true;
                     btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                 }
 
@@ -820,6 +867,7 @@
                         oldbuttonText = btnMethodText;
                         btnMethodText.IsSelected = true;
                         oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                        oldbuttonText.IsBold = true;
                     }
 
                     //鑾峰彇妤煎眰瀵瑰簲鐨勬埧闂�
@@ -862,7 +910,10 @@
             }
         }
 
-        //褰撳墠鎸夐敭鎵�鏈夋樉绀烘埧闂寸殑鎵�鏈夊満鏅鐞�
+        /// <summary>
+        /// 褰撳墠鎸夐敭鎵�鏈夋樉绀烘埧闂寸殑鎵�鏈夊満鏅鐞�
+        /// </summary>
+        /// <returns></returns>
         List<SceneUI> GetALlDispalyRoomSceneList()
         {
             currentKeyAllRoomSceneList.Clear();
@@ -887,6 +938,24 @@
             }
             return currentKeyAllRoomSceneList;
         }
+        /// <summary>
+        /// 鑾峰彇缃戝叧涓瓨鍦ㄧ殑鏈湴鍦烘櫙鍒楄〃
+        /// </summary>
+        /// <param name="curRoom"></param>
+        /// <returns></returns>
+        List<SceneUI> GetMatchSceneUIList(Shared.Common.Room curRoom)
+        {
+            var tempSceneUIList = new List<SceneUI>();
+            foreach (var scene in curRoom.SceneUIList)
+            {
+                var gwSc = gwCurScenesList.Find(obj => (obj.ScenesId == scene.Id));
+                if (gwSc != null)
+                {
+                    tempSceneUIList.Add(scene);
+                }
+            }
+            return tempSceneUIList;
+        }
 
         public void DeviceInfoChange(CommonDevice common, string typeTag)
         {

--
Gitblit v1.8.0