From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码

---
 ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs |  252 +++++++++++++++++++++++++++-----------------------
 1 files changed, 137 insertions(+), 115 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs
index 4a21360..45f0f72 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs
@@ -52,21 +52,21 @@
         {
             X = Application.GetRealWidth(58),
             Y = Application.GetRealHeight(184 + 200 + 280 + 40),
-            Height = Application.GetRealHeight(1920 - 40 - 184 - 280 - 200),
+            Height = Application.GetRealHeight(Method.H - 40 - 184 - 280 - 200),
             BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
         };
 
         public void Show(string Name)
         {
             #region  涓婇潰鐨勫竷灞�浠g爜
-            UserView.HomePage.Instance.ScrollEnabled = false;
+            UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦
             this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
             TopView view = new TopView();
             this.AddChidren(view.TopRowView(true));
-            view.toptitleNameBtn.Text = Name; 
+            view.toptitleNameBtn.Text = Name;
             view.clickBtn.MouseDownEventHandler += (sender, e) =>
             {
-                UserView.HomePage.Instance.ScrollEnabled = true;
+                UserView.HomePage.Instance.ScrollEnabled = true;//鎭㈠宸︽粦
                 RemoveFromParent();
             };
             view.foolrnameBtn.Text = Config.Instance.Home.GetCurrentFloorName;
@@ -87,8 +87,9 @@
             var roomlists = Method.GetRoomList(IfType, Config.Instance.Home.CurrentFloorId);
             if (roomlists.Count == 0)
             {
-                ///娌℃湁鎴块棿鐩存帴杩斿洖鍘伙紱
-                return;
+                //杩斿洖娌℃湁鎴块棿闅愯棌涓嬮潰鏁村潡;
+                devicetypehorizontalScrol.Height = 0;
+                middle.Height = 0;
             }
             /// 璁惧绫诲瀷鍒楄〃
             var deviceTypeList = Method.GetDevice(IfType);
@@ -98,110 +99,110 @@
             devicetypehorizontalScrol.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerBottomLeft);
             middle.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerTopLeft);
             ///妤煎眰鐐瑰嚮浜嬩欢
-            view.foolrclickBtn.MouseUpEventHandler+= (sender, e) =>
-            {
-                var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                this.AddChidren(flMain);
-                flMain.MouseUpEventHandler += (sender2, e2) =>
+            view.foolrclickBtn.MouseUpEventHandler += (sender, e) =>
                 {
-                    flMain.RemoveFromParent();
-                };
-                var foolrbjicon = new FrameLayout
-                {
-
-                    Width = Application.GetRealWidth(450),
-                    Height = Application.GetRealHeight(780),
-                    X = Application.GetRealWidth(1080 - 468 - 35),
-                    Y = Application.GetRealHeight(184),
-                    BackgroundImagePath = "Item/SelectFloor_Right.png",
-                };
-                flMain.AddChidren(foolrbjicon);
-
-                var btnfoolrtext = new Button
-                {
-                    Width = Application.GetRealWidth(450),
-                    Height = Application.GetRealHeight(150),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
-                    X = Application.GetRealWidth(80),
-                    TextID = MyInternationalizationString.selecfoolr,
-                    TextSize = 14,
-                };
-                foolrbjicon.AddChidren(btnfoolrtext);
-
-                var foolrbj = new VerticalScrolViewLayout
-                {
-
-                    Width = Application.GetRealWidth(450),
-                    Height = foolrbjicon.Height - btnfoolrtext.Height,
-                    X = Application.GetRealWidth(80),
-                    Y = btnfoolrtext.Bottom,
-                };
-                foolrbjicon.AddChidren(foolrbj);
-
-                foreach (var foolr in Config.Instance.Home.FloorDics)
-                {
-                    var foolrRowLayout = new RowLayout
+                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                    this.AddChidren(flMain);
+                    flMain.MouseUpEventHandler += (sender2, e2) =>
+                  {
+                      flMain.RemoveFromParent();
+                  };
+                    var foolrbjicon = new FrameLayout
                     {
-                        Height = Application.GetRealHeight(150),
-                        LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+
+                        Width = Application.GetRealWidth(450),
+                        Height = Application.GetRealHeight(780),
+                        X = Application.GetRealWidth(1080 - 468 - 35),
+                        Y = Application.GetRealHeight(184),
+                        BackgroundImagePath = "Item/SelectFloor_Right.png",
                     };
-                    foolrbj.AddChidren(foolrRowLayout);
+                    flMain.AddChidren(foolrbjicon);
 
-                    var btnfoolricon = new Button
+                    var btnfoolrtext = new Button
                     {
-                        Width = Application.GetRealWidth(81),
-                        Height = Application.GetRealHeight(81),
-                        UnSelectedImagePath = "Floor/Floor.png",
-                        Gravity = Gravity.CenterVertical,
-                    };
-                    foolrRowLayout.AddChidren(btnfoolricon);
-
-                    var btnfoolrname = new Button
-                    {
-                        Width = Application.GetRealWidth(250),
+                        Width = Application.GetRealWidth(450),
                         Height = Application.GetRealHeight(150),
-                        Text = foolr.Value,
                         TextAlignment = TextAlignment.CenterLeft,
-                        TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
-                        Tag = foolr.Key,
-                        X = btnfoolricon.Right + Application.GetRealWidth(12),
+                        TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+                        X = Application.GetRealWidth(80),
+                        TextID = MyInternationalizationString.selecfoolr,
                         TextSize = 14,
                     };
-                    foolrRowLayout.AddChidren(btnfoolrname);
-                    if (view.foolrnameBtn.Text == foolr.Value)
+                    foolrbjicon.AddChidren(btnfoolrtext);
+
+                    var foolrbj = new VerticalScrolViewLayout
                     {
-                        btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png";
-                        btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor;
+
+                        Width = Application.GetRealWidth(450),
+                        Height = foolrbjicon.Height - btnfoolrtext.Height,
+                        X = Application.GetRealWidth(80),
+                        Y = btnfoolrtext.Bottom,
+                    };
+                    foolrbjicon.AddChidren(foolrbj);
+
+                    foreach (var foolr in Config.Instance.Home.FloorDics)
+                    {
+                        var foolrRowLayout = new RowLayout
+                        {
+                            Height = Application.GetRealHeight(150),
+                            LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+                        };
+                        foolrbj.AddChidren(foolrRowLayout);
+
+                        var btnfoolricon = new Button
+                        {
+                            Width = Application.GetMinRealAverage(81),
+                            Height = Application.GetMinRealAverage(81),
+                            UnSelectedImagePath = "Floor/Floor.png",
+                            Gravity = Gravity.CenterVertical,
+                        };
+                        foolrRowLayout.AddChidren(btnfoolricon);
+
+                        var btnfoolrname = new Button
+                        {
+                            Width = Application.GetRealWidth(250),
+                            Height = Application.GetRealHeight(150),
+                            Text = foolr.Value,
+                            TextAlignment = TextAlignment.CenterLeft,
+                            TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
+                            Tag = foolr.Key,
+                            X = btnfoolricon.Right + Application.GetRealWidth(12),
+                            TextSize = 14,
+                        };
+                        foolrRowLayout.AddChidren(btnfoolrname);
+                        if (view.foolrnameBtn.Text == foolr.Value)
+                        {
+                            btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png";
+                            btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor;
+                        }
+
+                        EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
+                      {
+
+                          roomhorizontalScrol.RemoveAll();
+                          devicetypehorizontalScrol.RemoveAll();
+                          middle.RemoveAll();
+                          view.foolrnameBtn.Text = btnfoolrname.Text;
+                          flMain.RemoveFromParent();
+                          var list = Method.GetRoomList(IfType, btnfoolrname.Tag.ToString());
+                          if (list.Count == 0)
+                          {
+                              devicetypehorizontalScrol.Height = 0;
+                              middle.Height = 0;
+                          }
+                          else
+                          {
+                              devicetypehorizontalScrol.Height = Application.GetRealHeight(280);
+                              middle.Height = Application.GetRealHeight(1920 - 40 - 184 - 280 - 200);
+                          }
+                          AllRoomView(list, deviceTypeList);
+                      };
+                        foolrRowLayout.MouseUpEventHandler += foolrnameclick;
+                        btnfoolrname.MouseUpEventHandler += foolrnameclick;
+
                     }
 
-                    EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
-                    {
-
-                        roomhorizontalScrol.RemoveAll();
-                        devicetypehorizontalScrol.RemoveAll();
-                        middle.RemoveAll();
-                        view.foolrnameBtn.Text = btnfoolrname.Text;
-                        flMain.RemoveFromParent();
-                        var list = Method.GetRoomList(IfType, btnfoolrname.Tag.ToString());
-                        if (list.Count == 0)
-                        {
-                            devicetypehorizontalScrol.Height= 0;
-                            middle.Height = 0;
-                        }
-                        else
-                        {
-                            devicetypehorizontalScrol.Height= Application.GetRealHeight(280);
-                            middle.Height= Application.GetRealHeight(1920 - 40 - 184 - 280 - 200);
-                        }
-                        AllRoomView(list, deviceTypeList);
-                    };
-                    foolrRowLayout.MouseUpEventHandler += foolrnameclick;
-                    btnfoolrname.MouseUpEventHandler += foolrnameclick;
-
-                }
-
-            };
+                };
             AllRoomView(roomlists, deviceTypeList);
         }
         /// <summary>
@@ -244,7 +245,7 @@
                 };
                 fra.AddChidren(roomnameBtn);
 
-                if (i == 0)//
+                if (i == 0)//榛樿閫変腑绗竴涓埧闂�
                 {
                     roombjButton.IsSelected = false;
                     roombjButton = roombjBtn;
@@ -286,7 +287,7 @@
         /// <param name="devicelist">Devicelist.</param>
         void AllDeviceTypeView(List<CommonDevice> devicelist)
         {
-            var devicetypelist = Method.GetDeviceTypeList(IfType, devicelist);
+            var devicetypelist = Method.GetDeviceTypeList(devicelist);
             devicetypehorizontalScrol.RemoveAll();
             for (int i = 0; i < devicetypelist.Count; i++)
             {
@@ -312,8 +313,8 @@
 
                 var backgroundColor = new Button
                 {
-                    Width = Application.GetRealWidth(156),
-                    Height = Application.GetRealHeight(180),
+                    Width = Application.GetMinRealAverage(156),
+                    Height = Application.GetMinRealAverage(180),
                     X = Application.GetRealWidth(10),
                     UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png",
                     SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png",
@@ -323,8 +324,8 @@
 
                 var devicetypeicon = new Button
                 {
-                    Width = Application.GetRealWidth(84),
-                    Height = Application.GetRealHeight(84),
+                    Width = Application.GetMinRealAverage(84),
+                    Height = Application.GetMinRealAverage(84),
                     X = Application.GetRealWidth(46),
                     Y = Application.GetRealHeight(30),
                     UnSelectedImagePath =Method.GetDeviceTypeIcon(devicetype),
@@ -342,7 +343,17 @@
                     TextSize = 10,
                 };
                 deviceRowLayout.AddChidren(devicetypename);
-               
+
+
+                //if (i == 0)//榛樿閫変腑绗竴涓澶囩被鍨�
+                //{
+                //    devicetypeButton.IsSelected = false;
+                //    devicetypeButton = backgroundColor;
+                //    backgroundColor.IsSelected = true;
+                //    var list = Method.GetDeviceType(devicetypename.Text);
+                //    ConditionDeviceView(list, devicelist);
+                //}
+
                 EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) =>
                 {
                     devicetypeButton.IsSelected = false;
@@ -360,6 +371,7 @@
             ///鏄剧ず鎴块棿鎵�鏈夎澶�
             ConditionDeviceView(new List<DeviceType>(), devicelist);
 
+
         }
         /// <summary>
         /// 鍔犺浇璇ョ被鍨嬭澶囪鍥炬柟娉�
@@ -368,6 +380,7 @@
         /// <param name="devicelist">璁惧鍒楄〃</param>
         void ConditionDeviceView(List<DeviceType> deviceTypelist, List<CommonDevice> devicelist)
         {
+
             middle.RemoveAll();
             foreach (var common in devicelist)
             {
@@ -389,18 +402,18 @@
                 middle.AddChidren(deviceFramelayout);
                 var bjFramelayout = new FrameLayout
                 {
-                    Width = Application.GetRealWidth(112),
-                    Height = Application.GetRealHeight(112),
+                    Width = Application.GetMinRealAverage(112),
+                    Height = Application.GetMinRealAverage(112),
                     X = Application.GetRealWidth(58),
                     Y = Application.GetRealHeight(30 + 9),
-                    // Radius = (uint)Application.GetRealHeight(56),
+                     Radius = (uint)Application.GetMinRealAverage(56),
                     BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
                 };
                 deviceFramelayout.AddChidren(bjFramelayout);
                 var deviceIconBtn = new Button
                 {
-                    Width = Application.GetRealWidth(82),
-                    Height = Application.GetRealHeight(82),
+                    Width = Application.GetMinRealAverage(82),
+                    Height = Application.GetMinRealAverage(82),
                     Gravity = Gravity.Center,
                 };
                 bjFramelayout.AddChidren(deviceIconBtn);
@@ -410,9 +423,9 @@
                     Y = Application.GetRealHeight(30),
                     Width = Application.GetRealWidth(850),
                     Height = Application.GetRealHeight(130),
-                    X = Application.GetRealWidth(176 + 10),
-                    LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
-
+                    X = Application.GetRealWidth(176 + 25),
+                    //LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                    LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
                 };
                 deviceFramelayout.AddChidren(deviceRow);
                 var devicename = new Button
@@ -424,6 +437,16 @@
                     TextSize = 14,
                 };
                 deviceRow.AddChidren(devicename);
+
+                var lineBtn = new Button
+                {
+                    Y = deviceFramelayout.Height-1,
+                    Height = 1,
+                    Width = Application.GetRealWidth(850),
+                    X = Application.GetRealWidth(176 + 25),
+                    BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+                };
+                deviceFramelayout.AddChidren(lineBtn);
                 EventHandler<MouseEventArgs> devicclick = (sen, e) =>
                 {
                     clickbutton.IsSelected = false;
@@ -437,8 +460,7 @@
                     devicename.IsSelected = true;
                     var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                     this.AddChidren(flMain);
-                    CurrentDeviceState.CurrentDeviceView(flMain, common, false, IfType);
-
+                    CurrentDeviceState.CurrentDeviceView(flMain, common, false, IfType,0);
                 };
                 deviceFramelayout.MouseUpEventHandler += devicclick;
                 bjFramelayout.MouseUpEventHandler += devicclick;

--
Gitblit v1.8.0