From 3291885285dfd5d4f665c20676307878dc3163bc Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期五, 20 十二月 2019 16:28:53 +0800
Subject: [PATCH] 请合并最新代码(优化设备不支持的功能)

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs |  279 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 143 insertions(+), 136 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
old mode 100644
new mode 100755
index d4c8ace..bfb17c8
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -44,7 +44,7 @@
         public Action<List<BindListResponseObj>> action;
         Button btnFinifh;
         Button btnFloorText;
-        Dictionary<string, string> dicFloor;//妤煎眰鍒楄〃
+        Dictionary<string, string> dicFloor;//妤煎眰鍒楄〃
         List<SceneUI> currentKeyAllRoomSceneList = new List<SceneUI>();
         #endregion
 
@@ -67,7 +67,6 @@
             var btnAddFrameLayout = new FrameLayout
             {
                 X = Application.GetRealWidth(830),
-                Width = Application.GetRealWidth(200),
             };
             this.titleFrameLayout.AddChidren(btnAddFrameLayout);
 
@@ -95,6 +94,14 @@
             {
                 SideslipFramelayout();
             };
+            if (Common.Config.Instance.Home.FloorDics.Count == 0)
+            {
+                btnAddFrameLayout.Width = 0;
+            }
+            else
+            {
+                btnAddFrameLayout.Width = Application.GetRealWidth(200);
+            }
             MidFrameLayoutContent(btnFloorText);
         }
 
@@ -148,32 +155,32 @@
             btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName();
 
             if (Common.Config.Instance.Home.FloorDics.Count == 0)
-            {
-                // 鑾峰彇娌℃湁妤煎眰鎴块棿
+            {
+                // 鑾峰彇娌℃湁妤煎眰鎴块棿
                 foreach (var room in Shared.Common.Room.Lists)
                 {
                     if (string.IsNullOrEmpty(room.FloorId))
                     {
                         roomList.Add(room);
                     }
-                }
-            }
-            else
-            {
-                // 鑾峰彇妤煎眰瀵瑰簲瀵规埧闂�
-                foreach (var room in Shared.Common.Room.Lists)
-                {
-                    if (room.FloorId == currentKey.currentSelectFloorId)
-                    {
-                        roomList.Add(room);
-                    }
-                }
-            }
-            if (roomList.Count == 0)
-            {
-                return;
-            }
-            //棣栨鎷垮埌鎵�鏈夋埧闂翠腑鎸夐敭鐨勭洰鏍囧苟瀛樺偍
+                }
+            }
+            else
+            {
+                // 鑾峰彇妤煎眰瀵瑰簲瀵规埧闂�
+                foreach (var room in Shared.Common.Room.Lists)
+                {
+                    if (room.FloorId == currentKey.currentSelectFloorId)
+                    {
+                        roomList.Add(room);
+                    }
+                }
+            }
+            if (roomList.Count == 0)
+            {
+                return;
+            }
+            //棣栨鎷垮埌鎵�鏈夋埧闂翠腑鎸夐敭鐨勭洰鏍囧苟瀛樺偍
             GetALlDispalyRoomSceneList();
 
             if (currentKeyAllRoomSceneList.Count != 0)
@@ -184,8 +191,8 @@
                     {
                         var sc = currentKey.bindList.Find(obj => (obj != null) && (obj.BindScenesId == scTemp.Id));
                         if (sc != null)
-                        {
-                            targetList.Add(scTemp);
+                        {
+                            targetList.Add(scTemp);
                         }
                     }
                 }
@@ -194,7 +201,7 @@
             Shared.Common.Room curRoom = roomList[0];
             int index = 0;
             RefreshRoomList(curRoom, ref index);
-            RefreshSceneList(roomList[index]);
+            //RefreshSceneList(roomList[index]);
 
             if (curRoom.SceneUIList.Count == 0)
             {
@@ -205,33 +212,33 @@
             {
                 btnFinifh.Enable = true;
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-            }
-            if (targetList.Count == 0)
-            {
+            }
+            if (targetList.Count == 0)
+            {
                 btnFinifh.Enable = false;
-                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
-            }
+                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+            }
             else
             {
                 btnFinifh.Enable = true;
                 btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-            }
+            }
             btnFinifh.MouseUpEventHandler += async (sender, e) =>
             {
                 bool isFinish = false;
                 try
                 {
-                    if (targetList.Count == 0)
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            var myTip = new Tip();
-                            myTip.Direction = AMPopTipDirection.None;
-                            myTip.CloseTime = 2;
-                            myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty);
+                    if (targetList.Count == 0)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            var myTip = new Tip();
+                            myTip.Direction = AMPopTipDirection.None;
+                            myTip.CloseTime = 2;
+                            myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty);
                             myTip.Show(Common.CommonPage.Instance);
                         });
-                        return;
+                        return;
                     }
 
                     Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); });
@@ -259,7 +266,7 @@
                         else
                         {
                             Application.RunOnMainThread(() =>
-                            {
+                            {
                                 CommonPage.Loading.Hide();
                                 var myTip = new Tip();
                                 myTip.Direction = AMPopTipDirection.None;
@@ -267,7 +274,7 @@
                                 myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime);
                                 myTip.Show(Common.CommonPage.Instance);
                             });
-                            btnFinifh.Enable = true;
+                            btnFinifh.Enable = true;
                             btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                             return;
                         }
@@ -275,19 +282,19 @@
 
                     var temp = await currentKey.ConfigureHdlKeyValueAsync(Panel.KeyMode.Scene_Trigger);
                     if (temp == null || temp.setWritableValueResponData == null)
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            CommonPage.Loading.Hide();
-                            var myTip = new Tip();
-                            myTip.Direction = AMPopTipDirection.None;
-                            myTip.CloseTime = 2;
-                            myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime);
-                            myTip.Show(Common.CommonPage.Instance);
-                        });
-                        btnFinifh.Enable = true;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                        return;
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            CommonPage.Loading.Hide();
+                            var myTip = new Tip();
+                            myTip.Direction = AMPopTipDirection.None;
+                            myTip.CloseTime = 2;
+                            myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime);
+                            myTip.Show(Common.CommonPage.Instance);
+                        });
+                        btnFinifh.Enable = true;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                        return;
                     }
                     if (temp.setWritableValueResponData.Status != 0)
                     {
@@ -297,10 +304,10 @@
                             myTip.Direction = AMPopTipDirection.None;
                             myTip.CloseTime = 2;
                             myTip.Text = Language.StringByID(R.MyInternationalizationString.ChangeBindMode);
-                            myTip.Show(Common.CommonPage.Instance);
-                            CommonPage.Loading.Hide();
+                            myTip.Show(Common.CommonPage.Instance);
+                            CommonPage.Loading.Hide();
                         });
-                        btnFinifh.Enable = true;
+                        btnFinifh.Enable = true;
                         btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                         return;
                     }
@@ -459,7 +466,7 @@
                     Width = Application.GetRealWidth(255),
                     Y = Application.GetRealHeight(23),
                     X = Application.GetRealWidth(5),
-                    BackgroundImagePath = "Item/RoomIconBackground.png",
+                    BackgroundImagePath = "Item/RoomIconBackground.png",
                     BorderWidth = 1,
                 };
                 btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayout);
@@ -480,7 +487,7 @@
                 btnRoom.IsSelected = false;
                 if (index == 0)
                 {
-                    btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
+                    btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
                     btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite;
                     curentOldRoom = btnRoom;
                     curentOldRoomFrameLayout = btnRoomFrameLayout;
@@ -501,7 +508,7 @@
                         if (curentOldRoomFrameLayout != null)
                         {
                             curentOldRoomFrameLayout.BorderWidth = 1;
-                            curentOldRoomFrameLayout.BorderColor = Shared.Common.ZigbeeColor.Current.XMOrange;
+                            curentOldRoomFrameLayout.BorderColor = Shared.Common.ZigbeeColor.Current.XMOrange;
                             curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackground.png";
                         }
                         curentOldRoomFrameLayout = btnRoomFrameLayout;
@@ -510,25 +517,25 @@
                     }
                     curRoom = room;
                     currentKey.RoomId = room.Id;
-                    if (curRoom.SceneUIList.Count == 0)
-                    {
-                        btnFinifh.Enable = false;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
-                    }
-                    else
-                    {
-                        btnFinifh.Enable = true;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    }
-                    if (targetList.Count == 0)
-                    {
-                        btnFinifh.Enable = false;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
-                    }
-                    else
-                    {
-                        btnFinifh.Enable = true;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    if (curRoom.SceneUIList.Count == 0)
+                    {
+                        btnFinifh.Enable = false;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+                    }
+                    else
+                    {
+                        btnFinifh.Enable = true;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    }
+                    if (targetList.Count == 0)
+                    {
+                        btnFinifh.Enable = false;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+                    }
+                    else
+                    {
+                        btnFinifh.Enable = true;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                     }
                     RefreshSceneList(curRoom);
 
@@ -567,7 +574,7 @@
                     Y = Application.GetMinRealAverage(46),
                     Width = Application.GetMinRealAverage(81),
                     Height = Application.GetMinRealAverage(81),
-                    UnSelectedImagePath = scene.IconPath,
+                    UnSelectedImagePath = "Scene/SceneIcon.png",// scene.IconPath,
                 };
                 rowLayout.AddChidren(devicePic);
 
@@ -616,30 +623,30 @@
                 {
                     btnBindName.Text = scene.Name;
                 }
-                if (targetList.Count == 0)
-                {
-                    foreach (var bindedSc in currentKey.bindList)
-                    {
-                        if (scene.Id == bindedSc.BindScenesId)
-                        {
-                            btnChoose.IsSelected = true;
-                            btnChoose.Visible = true;
-                            oldScene = btnChoose;
-                            targetList.Add(scene);
-                        }
+                if (targetList.Count == 0)
+                {
+                    foreach (var bindedSc in currentKey.bindList)
+                    {
+                        if (scene.Id == bindedSc.BindScenesId)
+                        {
+                            btnChoose.IsSelected = true;
+                            btnChoose.Visible = true;
+                            oldScene = btnChoose;
+                            targetList.Add(scene);
+                        }
                     }
-                }
-                else
-                {
-                    foreach (var bindedSc in targetList)
+                }
+                else
+                {
+                    foreach (var bindedSc in targetList)
                     {
                         var sc1 = (SceneUI)bindedSc;
-                        if (scene.Id == sc1.Id)
-                        {
-                            btnChoose.IsSelected = true;
-                            btnChoose.Visible = true;
+                        if (scene.Id == sc1.Id)
+                        {
+                            btnChoose.IsSelected = true;
+                            btnChoose.Visible = true;
                             oldScene = btnChoose;
-                        }
+                        }
                     }
                 }
 
@@ -673,16 +680,16 @@
                         currentKey.curSelectSceneID = scene.Id.ToString();
                         targetList.Clear();
                         targetList.Add(scene);
-                    }
-                    if (targetList.Count == 0)
-                    {
-                        btnFinifh.Enable = false;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
-                    }
-                    else
-                    {
-                        btnFinifh.Enable = true;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    }
+                    if (targetList.Count == 0)
+                    {
+                        btnFinifh.Enable = false;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+                    }
+                    else
+                    {
+                        btnFinifh.Enable = true;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                     }
                 };
                 rowLayout.MouseUpEventHandler += hander;
@@ -690,16 +697,16 @@
                 btnBindName.MouseUpEventHandler += hander;
                 btnChoose.MouseUpEventHandler += hander;
                 curIndex++;
-            }
-            if (targetList.Count == 0)
-            {
-                btnFinifh.Enable = false;
-                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
-            }
-            else
-            {
-                btnFinifh.Enable = true;
-                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+            }
+            if (targetList.Count == 0)
+            {
+                btnFinifh.Enable = false;
+                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+            }
+            else
+            {
+                btnFinifh.Enable = true;
+                btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
             }
         }
 
@@ -837,15 +844,15 @@
                     int index = 0;
                     RefreshRoomList(curRoom, ref index);
                     RefreshSceneList(roomList[0]);
-                    if (targetList.Count == 0)
-                    {
-                        btnFinifh.Enable = false;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
-                    }
-                    else
-                    {
-                        btnFinifh.Enable = true;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    if (targetList.Count == 0)
+                    {
+                        btnFinifh.Enable = false;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+                    }
+                    else
+                    {
+                        btnFinifh.Enable = true;
+                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                     }
                     dialog.Close();
                 };
@@ -858,9 +865,9 @@
         //褰撳墠鎸夐敭鎵�鏈夋樉绀烘埧闂寸殑鎵�鏈夊満鏅鐞�
         List<SceneUI> GetALlDispalyRoomSceneList()
         {
-            currentKeyAllRoomSceneList.Clear();
+            currentKeyAllRoomSceneList.Clear();
             // 鑾峰彇鎵�鏈夋埧闂� 
-            foreach (var room in Shared.Common.Room.Lists)
+            foreach (var room in Shared.Common.Room.Lists)
             {
                 //濡傛灉鎴块棿涓哄枩鐖憋紝鍒欎笉鏄剧ず
                 if (room.IsLove == true)
@@ -873,10 +880,10 @@
                     continue;
                 }
 
-                foreach (var scene in room.SceneUIList)
-                {
-                    currentKeyAllRoomSceneList.Add(scene);
-                }
+                foreach (var scene in room.SceneUIList)
+                {
+                    currentKeyAllRoomSceneList.Add(scene);
+                }
             }
             return currentKeyAllRoomSceneList;
         }

--
Gitblit v1.8.0