From c47c3ec2488961b3a006aaebcb03dba582f8b19b Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 12 三月 2020 17:08:42 +0800
Subject: [PATCH] 2020-03-12-1

---
 ZigbeeApp/Shared/Phone/Device/Category/SelectScene.cs |   86 ++++++++++++++++++++++++++----------------
 1 files changed, 53 insertions(+), 33 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/SelectScene.cs b/ZigbeeApp/Shared/Phone/Device/Category/SelectScene.cs
index 7b3c175..191ddbd 100755
--- a/ZigbeeApp/Shared/Phone/Device/Category/SelectScene.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/SelectScene.cs
@@ -23,11 +23,15 @@
         /// <summary>
         /// BeforesceneTargetDeviceUIs
         /// </summary>
-        public List<SceneTargetDeviceUI> beforeSceneTargetDeviceUIs=new List<SceneTargetDeviceUI> { };
+        public List<SceneTargetDeviceUI> beforeSceneTargetDeviceUIs = new List<SceneTargetDeviceUI> { };
         /// <summary>
         /// 妤煎眰
         /// </summary>
         private Button floorBtn;
+        /// <summary>
+        /// 褰撳墠妤煎眰id
+        /// </summary>
+        private string curFloorId;
         /// <summary>
         /// 閫夋嫨妤煎眰
         /// </summary>
@@ -40,7 +44,10 @@
         /// sceneUI
         /// </summary>
         public SceneUI sceneUI;
-
+        /// <summary>
+        /// 褰撳墠鍦烘櫙鏈韩锛屾坊鍔犲満鏅椂浣跨敤
+        /// </summary>
+        public SceneUI currentSceneUI;
 
         #endregion
 
@@ -93,6 +100,8 @@
                 Gravity = Gravity.CenterVertical,
                 TextAlignment = TextAlignment.CenterRight,
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                TextSize = 14,
+                IsBold = true
             };
 
             selectFloorBtn = new Button()
@@ -123,9 +132,12 @@
         {
             var floors = new SelectFloor();
             AddChidren(floors);
+            floors.changeFloor = false;
+            floors.CurFloorId = curFloorId;
             floors.Init(580, 184, Direction.Right);
             floors.FloorAction += (floorId) =>
             {
+                curFloorId = floorId;
                 floorBtn.Text = Config.Instance.Home.GetFloorNameById(floorId);
                 RefreshBodyView(floorId);
             };
@@ -148,7 +160,7 @@
             confirmBtn.SetTitle(R.MyInternationalizationString.Save);
             confirmBtn.MouseUpEventHandler += (sender, e) =>
             {
-                sceneTargetDevice.ElseScenesId = sceneUI.Id ;
+                sceneTargetDevice.ElseScenesId = sceneUI.Id;
                 sceneTargetDevice.SceneUI = sceneUI;
                 sceneTargetDevice.SceneName = sceneUI.Name;
                 selectedAction?.Invoke(sceneTargetDevice);
@@ -184,35 +196,26 @@
             functionSceneBodyView = new FrameLayout()
             {
                 Y = roomFL.Bottom,
-                Height = Application.GetRealHeight(910+622),
+                Height = Application.GetRealHeight(1080 + 452),
                 BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
             };
             bodyFrameLayout.AddChidren(functionSceneBodyView);
 
-            Button curBtn = new Button();
-            foreach (var room in Common.Room.CurrentRoom.GetRoomsByFloorIdAppendLoveRoom(floorId))
+            RoomButton curBtn = new RoomButton(0,0);
+
+            foreach (var room in UserCenter.HdlRoomLogic.Current.GetRoomsByFloorIdAppendLoveRoom(floorId))
             {
                 var row = new FrameLayout()
                 {
-                    Width = Application.GetRealWidth(187 + 50),
-                    Height = Application.GetRealHeight(204),
+                    Width = Application.GetRealWidth(255),
+                    Height = Application.GetRealHeight(167)
                 };
                 roomFL.AddChidren(row);
 
-                var roomBtn = new Button()
-                {
-                    Width = Application.GetRealWidth(187),
-                    Height = Application.GetRealHeight(78),
-                    Radius = (uint)Application.GetRealHeight(78 / 2),
-                    Gravity = Gravity.Center,
-                    Text = room.Name,
-                    TextColor = ZigbeeColor.Current.GXCTextGrayColor,
-                    SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                    BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor3,
-                    SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonSelectedColor,
-                    BorderColor = ZigbeeColor.Current.GXCBorderUnSelectedColor,
-                    BorderWidth = 1
-                };
+                RoomButton roomBtn = new RoomButton(0, 0);
+                roomBtn.Gravity = Gravity.Center;
+                roomBtn.Init();
+                roomBtn.SetTitle(room.Name);
                 row.AddChidren(roomBtn);
 
                 if (room.IsLove)
@@ -222,15 +225,15 @@
 
                     RefreshScene(room);
                 }
-                roomBtn.MouseUpEventHandler += (sender, e) =>
+                roomBtn.ButtonClickEvent += (sender, e) =>
                 {
-                    if ((sender as Button) == curBtn)
+                    if (sender == curBtn)
                     {
                         return;
                     }
-                    (sender as Button).IsSelected = true;
+                    sender.IsSelected = true;
                     curBtn.IsSelected = false;
-                    curBtn = sender as Button;
+                    curBtn = sender;
 
                     RefreshScene(room);
                 };
@@ -246,7 +249,7 @@
         public void RefreshScene(Common.Room room)
         {
             functionSceneBodyView.RemoveAll();
-            var sceneList = room.SceneUIList;
+            var sceneList = room.ListSceneId;
             if (sceneList.Count == 0)
             {
                 ShowNoSceneTip();
@@ -257,9 +260,11 @@
                 {
                     //Y = Application.GetRealHeight(58)
                 };
+
                 functionSceneBodyView.AddChidren(sceneScrolView);
                 SelectSceneRow tempSceneRow = new SelectSceneRow();
-                EventHandler<MouseEventArgs> selectScene = (sender, e) => {
+                EventHandler<MouseEventArgs> selectScene = (sender, e) =>
+                {
                     tempSceneRow.IsSelected = false;
                     tempSceneRow = ((sender as Button).Parent as SelectSceneRow);
                     ((sender as Button).Parent as SelectSceneRow).IsSelected = true;
@@ -269,7 +274,11 @@
 
                 for (int i = 0; i < sceneList.Count; i++)
                 {
-                    var scene = sceneList[i];
+                    var scene = UserCenter.HdlSceneLogic.Current.GetSceneUIBySceneId(sceneList[i]);
+                    if (scene == null || currentSceneUI?.Id == scene.Id)
+                    {
+                        continue;
+                    }
                     if (beforeSceneTargetDeviceUIs.Find((obj) => obj.SceneUI.Id == scene.Id) != null)
                     {
                         continue;
@@ -286,7 +295,7 @@
                     sceneRowLayout.Init();
                     sceneRowLayout.SetTitle(scene.Name);
                     sceneRowLayout.ClickButton.Tag = scene;
-                    if(sceneUI==null)
+                    if (sceneUI == null)
                     {
                         if (i == 0)
                         {
@@ -297,18 +306,29 @@
                     }
                     else
                     {
-                        if(sceneUI.Id==scene.Id)
+                        if (sceneUI.Id == scene.Id)
                         {
                             tempSceneRow = sceneRowLayout;
                             sceneUI = scene;
                             sceneRowLayout.IsSelected = true;
                         }
                     }
-                    
+
                     sceneRowLayout.ClickButton.MouseUpEventHandler += selectScene;
                 }
+
+                if (sceneList.Count > 8)
+                {
+                    var frame = new FrameLayout
+                    {
+                        Height = Application.GetRealHeight(300)
+                    };
+                    sceneScrolView.AddChidren(frame);
+                }
+
             }
         }
+    
 
         /// <summary>
         /// 鏄剧ず娌℃湁鍦烘櫙
@@ -331,7 +351,7 @@
                 Height = Application.GetRealHeight(200),
                 Width = Application.GetRealWidth(700),
                 Gravity = Gravity.CenterHorizontal,
-                Text = Language.StringByID(R.MyInternationalizationString.NoScene).Replace("{\\r\\n}", "\r\n"),
+                Text = Language.StringByID(R.MyInternationalizationString.NoScene_Tip).Replace("{\\r\\n}", "\r\n"),
                 TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
                 TextAlignment = TextAlignment.Center,
                 IsMoreLines = true

--
Gitblit v1.8.0