From b78a4d0ca90416d37fcbaf5e54b00f7eaab53919 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 14 十月 2019 17:03:58 +0800
Subject: [PATCH] 2019-10-14-2

---
 ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs |   57 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs
index 06624b8..c23bbf5 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplateDeviceCondition.cs
@@ -87,7 +87,8 @@
                 Width = Application.GetRealWidth(400),
                 Height = Application.GetRealHeight(69),
                 Y = Application.GetRealHeight(92),
-                TextID = MyInternationalizationString.customroom,
+                // TextID = MyInternationalizationString.customroom,
+                Text = Config.Instance.Home.GetCurrentFloorName,
             };
             topRowLayout.AddChidren(foolrname);
             var dropdown = new Button
@@ -157,7 +158,7 @@
             };
 
             ///妤煎眰鐐瑰嚮浜嬩欢
-            foolrname.MouseUpEventHandler += (sender, e) =>
+            EventHandler<MouseEventArgs> foorlclick=(sender,e) =>
             {
 
                 var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
@@ -178,8 +179,7 @@
                 };
                 flMain.AddChidren(foolrbj);
                 ///榛樿璋冭瘯
-                List<string> foolrlist = new List<string> { "涓�妤�", "浜屾ゼ", "涓夋ゼ" };
-                foreach (var foolr in foolrlist)
+                foreach (var foolr in Config.Instance.Home.FloorDics)
                 {
                     var foolrRowLayout = new FrameLayout
                     {
@@ -191,32 +191,55 @@
                     {
                         Width = Application.GetRealWidth(250),
                         Height = Application.GetRealHeight(160),
-                        Text = foolr,
+                        Text = foolr.Value,
                         TextAlignment = TextAlignment.Center,
                         TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                        //SelectedTextColor=0xfffc744b,
+                        Tag = foolr.Key,
                     };
                     foolrRowLayout.AddChidren(btnfoolrname);
 
 
-                    EventHandler<MouseEventArgs> foolrclick = (sender13, e13) =>
+                    EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
                     {
                         roomhorizontalScrol.RemoveAll();
                         foolrname.Text = btnfoolrname.Text;
                         flMain.RemoveFromParent();
-                        ///澶囨敞锛氭樉绀洪�変腑妤煎眰鐨勬墍鏈夋埧闂�
-                        AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
+                        var list = Send.GetRoomList(btnfoolrname.Tag.ToString());
+                        AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
 
                     };
-                    foolrRowLayout.MouseUpEventHandler += foolrclick;
-                    btnfoolrname.MouseUpEventHandler += foolrclick;
+                    foolrRowLayout.MouseUpEventHandler += foolrnameclick;
+                    btnfoolrname.MouseUpEventHandler += foolrnameclick;
 
 
                 }
 
             };
-            ///绗竴娆¤繘鏉�
-            AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
+            foolrname.MouseUpEventHandler += foorlclick;
+            dropdown.MouseUpEventHandler += foorlclick;
+
+            var roomlists = new List<Common.Room>();
+            roomlists.Clear();
+            if (Config.Instance.Home.FloorDics.Count < 1)
+            {
+                foolrname.Visible = false;
+                dropdown.Visible = false;
+                if (Config.Instance.Home.FloorDics.Count == 0)
+                {
+                    roomlists.AddRange(Common.Room.Lists);
+                }
+                else
+                {
+                    roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
+                }
+            }
+            else
+            {
+                roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
+
+            }
+
+            AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
         }
         /// <summary>
         /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶
@@ -271,6 +294,10 @@
                     var list = new List<DeviceUI>();
                     foreach (var device in room.DeviceUIList)
                     {
+                        if (device.CommonDevice == null)
+                        {
+                            continue;
+                        }
                         if (!deviceTypeList.Contains(device.CommonDevice.Type))
                         {
                             continue;
@@ -297,6 +324,10 @@
                     var list = new List<DeviceUI>();
                     foreach (var device in room.DeviceUIList)
                     {
+                        if (device.CommonDevice == null)
+                        {
+                            continue;
+                        }
                         if (!deviceTypeList.Contains(device.CommonDevice.Type))
                         {
                             continue;

--
Gitblit v1.8.0