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/DeviceStateCondition.cs |   56 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
index b61b296..72ab9f6 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceStateCondition.cs
@@ -88,7 +88,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
@@ -102,6 +103,7 @@
                 UnSelectedImagePath = "ZigeeLogic/drop-down.png",
             };
             topRowLayout.AddChidren(dropdown);
+
             #endregion
 
             ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
@@ -158,7 +160,7 @@
             };
 
             ///妤煎眰鐐瑰嚮浜嬩欢
-            foolrname.MouseUpEventHandler += (sender, e) =>
+            EventHandler<MouseEventArgs> foorlclick = (sender, e) =>
             {
 
                 var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
@@ -178,10 +180,9 @@
                     Radius = (uint)Application.GetRealHeight(30),
                 };
                 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
                     {
                         Height = Application.GetRealHeight(150),
@@ -192,32 +193,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;
 
 
                 }
 
             };
+            foolrname.MouseUpEventHandler += foorlclick;
+            dropdown.MouseUpEventHandler += foorlclick;
             ///绗竴娆¤繘鏉�
-            AllRoomView(Common.Room.Lists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
+            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>
         /// 鍔犺浇鎵�鏈夋埧闂寸殑瑙嗗浘鏂规硶
@@ -272,6 +296,9 @@
                     var list = new List<DeviceUI>();
                     foreach (var device in room.DeviceUIList)
                     {
+                        if (device.CommonDevice==null) {
+                            continue;
+                        }
                         if (!deviceTypeList.Contains(device.CommonDevice.Type))
                         {
                             continue;
@@ -298,6 +325,9 @@
                     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