From cf0bffdf072bae11bdb8c780d0a355818700f713 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 18 五月 2020 15:42:45 +0800
Subject: [PATCH] 请合并代码,优化面板问题

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs |   99 ++++++++++++++++++++++++++-----------------------
 1 files changed, 53 insertions(+), 46 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
index 5414e02..19c5766 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/AddScenePage.cs
@@ -151,7 +151,6 @@
             btnHorizontalScrolViewLayout = new HorizontalScrolViewLayout
             {
                 X = Application.GetRealWidth(58),
-                BackgroundColor = 0xff00ff00,
             };
             btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout);
 
@@ -491,11 +490,11 @@
                 {
                     roomTempList.Add(room);
                 }
-                if (roomTempList.Count != 0)
-                {
-                    curRoom = roomTempList[0];
-                }
-
+            }
+            for (int i = 0; i < roomTempList.Count; i++)
+            {
+                var room = roomTempList[i];
+                curRoom = roomTempList[0];
                 var btnRoomFrameLayout = new FrameLayout
                 {
                     Height = Application.GetMinReal(159),
@@ -528,6 +527,20 @@
                     curentOldRoom = btnRoom;
                     curentOldRoomFrameLayout = btnRoomFrameLayout;
                 }
+
+                if (index == roomTempList.Count - 1 && index > 3)
+                {
+                    var btnRoomFrameLayoutEmpty = new FrameLayout
+                    {
+                        Height = Application.GetMinReal(159),
+                        Width = Application.GetMinReal(50),
+                        Y = Application.GetRealHeight(23),
+                        X = Application.GetRealWidth(5),
+                        BorderWidth = 1,
+                    };
+                    btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty);
+                }
+
                 EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) =>
                 {
                     if (!btnRoom.IsSelected)
@@ -695,48 +708,42 @@
                     }
                 }
 
-                bool IsTip = false;
                 EventHandler<MouseEventArgs> hander = (sender, e) =>
-                {
-                    if (currentKey.bindList.Count != 0)
-                    {
-                        if (IsTip)
-                        {
-                            return;
-                        }
-                        IsTip = true;
-                        if (btnChoose.IsSelected)
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnBindName);
-                            return;
-                        }
-                    }
+               {
+                   if (currentKey.bindList.Count != 0)
+                   {
+                       if (btnChoose.IsSelected)
+                       {
+                           new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnBindName);
+                           return;
+                       }
+                   }
 
-                    if (!btnChoose.IsSelected)
-                    {
-                        if (oldScene != null)
-                        {
-                            oldScene.IsSelected = false;
-                            oldScene.Visible = false;
-                        }
-                        oldScene = btnChoose;
-                        oldScene.IsSelected = true;
-                        oldScene.Visible = true;
-                        targetListDevice.Clear();
-                        targetListScene.Clear();
-                        targetListScene.Add(scene);
-                    }
-                    if (targetListDevice.Count == 0 && targetListScene.Count == 0)
-                    {
-                        btnFinifh.Enable = false;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
-                    }
-                    else
-                    {
-                        btnFinifh.Enable = true;
-                        btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    }
-                };
+                   if (!btnChoose.IsSelected)
+                   {
+                       if (oldScene != null)
+                       {
+                           oldScene.IsSelected = false;
+                           oldScene.Visible = false;
+                       }
+                       oldScene = btnChoose;
+                       oldScene.IsSelected = true;
+                       oldScene.Visible = true;
+                       targetListDevice.Clear();
+                       targetListScene.Clear();
+                       targetListScene.Add(scene);
+                   }
+                   if (targetListDevice.Count == 0 && targetListScene.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;
                 devicePic.MouseUpEventHandler += hander;
                 btnBindName.MouseUpEventHandler += hander;

--
Gitblit v1.8.0