From f23ad1b3f9f6193f35f72104d690b21dc67d5c1f Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 06 七月 2020 12:35:25 +0800
Subject: [PATCH] 去掉了访问外网的异步

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs |  240 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 230 insertions(+), 10 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs
index 03b207f..5c66c54 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindCommonLayout.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using Shared.Common;
 using ZigBee.Device;
 
@@ -11,8 +12,18 @@
 
         }
         #region 鈼� 鍙橀噺鐢虫槑__________________________
+        /// <summary>
+        /// 妤煎眰鍥炶皟
+        /// </summary>
+        public Action FloorAction = null;
+        /// <summary>
+        /// 閫変腑鐨勬ゼ灞傚洖璋僛
+        /// </summary>
+        public Action<string, Button> ChooseFloorAction = null;
+
         public FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout };
-        public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1921 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout };
+        public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1925 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout };
+
         public FrameLayout bottomRadiusFrameLayout = new FrameLayout()
         {
             Height = Application.GetRealHeight(100),
@@ -20,35 +31,47 @@
             Radius = 17,
             BackgroundColor = ZigbeeColor.Current.XMWhite,
         };
+
         public FrameLayout titleFrameLayout = new FrameLayout
         {
             Y = Application.GetRealHeight(92),
+            X = Application.GetRealWidth(161),
+            Width = Application.GetRealWidth(1080 - 161),//919
             Height = Application.GetRealHeight(69),
         };
         public Button btnTitle = new Button
         {
             TextAlignment = TextAlignment.CenterLeft,
             TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
-            X = Application.GetRealWidth(161),
-            Width = Application.GetRealWidth(1080 - 161),
+            Width = Application.GetRealWidth(1080 - 161),//919
             Height = Application.GetRealWidth(69),
             TextSize = 17,
-            IsBold = true
+            IsBold = true,
+            //X = Application.GetRealWidth(161 - 116),
         };
+        /// <summary>
+        /// 鏍囬杩斿洖甯冨眬
+        /// </summary>
         public FrameLayout btnBackFrameLayout = new FrameLayout
         {
-            X = Application.GetRealWidth(58),
-            Height = Application.GetRealHeight(58),
-            Width = Application.GetRealWidth(58),
+            Width = Application.GetRealWidth(58 * 2),//116
         };
 
+        /// <summary>
+        /// 鏍囬杩斿洖鎸夐敭
+        /// </summary>
         public Button btnBack = new Button
         {
             Height = Application.GetRealHeight(51),
             Width = Application.GetRealWidth(30),
+            X = Application.GetRealWidth(58),
+            Y = Application.GetRealHeight(98),
             UnSelectedImagePath = "DoorLock/Left.png",
         };
 
+        /// <summary>
+        /// 鏍囬涓嬬嚎
+        /// </summary>
         public Button btnTitleLine = new Button
         {
             Y = Application.GetRealHeight(181),
@@ -58,18 +81,18 @@
         #endregion
 
         /// <summary>
-        /// 闂ㄩ攣椤堕儴甯冨眬
+        /// 椤堕儴甯冨眬
         /// </summary>
         /// <param name="frameLayout"></param>
         public void TopFrameLayout(FrameLayout frameLayout, string titleText)
         {
             this.AddChidren(topFrameLayout);
+            topFrameLayout.AddChidren(btnBackFrameLayout);
             topFrameLayout.AddChidren(titleFrameLayout);
             topFrameLayout.AddChidren(btnTitleLine);
+            btnBackFrameLayout.AddChidren(btnBack);
             titleFrameLayout.AddChidren(btnTitle);
             btnTitle.Text = titleText;
-            titleFrameLayout.AddChidren(btnBackFrameLayout);
-            btnBackFrameLayout.AddChidren(btnBack);
         }
         /// <summary>
         /// 闂ㄩ攣涓儴甯冨眬
@@ -96,5 +119,202 @@
             };
             this.midFrameLayout.AddChidren(bottomFrameLayout1);
         }
+
+        /// <summary>
+        /// 娣诲姞妤煎眰UI
+        /// </summary> 
+        public void BindDownFrameLayout(FrameLayout frameLayout, Panel curControlDev, Dictionary<string, string> dicFloorList, ref Button btnFloorText)
+        {
+            var btnAddFrameLayout = new FrameLayout
+            {
+                X = Application.GetRealWidth(619),
+            };
+            this.titleFrameLayout.AddChidren(btnAddFrameLayout);
+
+            btnFloorText = new Button
+            {
+                Width = Application.GetRealWidth(300 - 69 - 58),
+                Text = Language.StringByID(R.MyInternationalizationString.FirstFloor),
+                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+                TextSize = 14,
+                IsBold = true,
+                TextAlignment = TextAlignment.CenterRight,
+            };
+            btnAddFrameLayout.AddChidren(btnFloorText);
+
+            var btnBindDownFrameLayout = new FrameLayout
+            {
+                Width = Application.GetMinReal(69 + 58),
+                X = Application.GetRealWidth(300 - 69 - 58),
+            };
+            btnAddFrameLayout.AddChidren(btnBindDownFrameLayout);
+
+            var btnBindDown = new Button
+            {
+                Height = Application.GetMinReal(69),
+                Width = Application.GetMinReal(69),
+                UnSelectedImagePath = "BindPic/BindDown.png",
+                Gravity = Gravity.CenterVertical,
+            };
+            btnBindDownFrameLayout.AddChidren(btnBindDown);
+
+            EventHandler<MouseEventArgs> eHandlerBindDown = (sender, e) =>
+            {
+                if (dicFloorList == null)
+                {
+                    dicFloorList = new Dictionary<string, string>();
+                }
+                SideslipFramelayout(curControlDev, dicFloorList);
+            };
+            btnBindDown.MouseDownEventHandler += eHandlerBindDown;
+            btnBindDownFrameLayout.MouseDownEventHandler += eHandlerBindDown;
+            if (Common.Config.Instance.Home.FloorDics.Count == 0)
+            {
+                btnAddFrameLayout.Width = 0;
+            }
+            else
+            {
+                btnAddFrameLayout.Width = Application.GetRealWidth(300);
+            }
+        }
+
+        /// <summary>
+        /// 妤煎眰閫夋嫨鐨勪晶杈规爮
+        /// </summary>
+        void SideslipFramelayout(Panel curControlDev, Dictionary<string, string> dicFloorList)
+        {
+            var dialog = new Dialog
+            {
+            };
+            dialog.Show();
+
+            var flMain = new FrameLayout { BackgroundColor = 0x00000000 };
+            dialog.AddChidren(flMain);
+            flMain.MouseUpEventHandler += (sender11, e11) =>
+            {
+                dialog.Close();
+            };
+
+            var sidelipFrameLayout = new FrameLayout()
+            {
+                Width = Application.GetMinReal(449),
+                Y = Application.GetRealHeight(161),
+                X = Application.GetRealWidth(596),
+                BackgroundImagePath = "DoorLock/SideslipPic.png",
+            };
+            flMain.AddChidren(sidelipFrameLayout);
+
+            var btnSelectFloor = new Button()
+            {
+                Width = Application.GetRealWidth(200),
+                Height = Application.GetRealHeight(58),
+                X = Application.GetRealWidth(81),
+                Y = Application.GetRealHeight(81),
+                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
+                TextSize = 14,
+                IsBold = true,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextID = R.MyInternationalizationString.SelectFloor,
+            };
+            sidelipFrameLayout.AddChidren(btnSelectFloor);
+
+            var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout()
+            {
+                Y = btnSelectFloor.Bottom + Application.GetRealHeight(45),
+                Height = Application.GetRealHeight(600),
+            };
+            sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
+
+            Button oldbutton = null;
+            Button oldbuttonText = null;
+            int count = 0;
+            foreach (var floorId in dicFloorList.Keys)
+            {
+                var rowFrameLayout = new RowLayout()
+                {
+                    Height = Application.GetRealHeight(152),
+                    LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+                    X = Application.GetRealWidth(81),
+                };
+                sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout);
+
+                var btnAllMethod = new Button()
+                {
+                    Width = Application.GetMinReal(81),
+                    Height = Application.GetMinReal(81),
+                    UnSelectedImagePath = "Floor/Floor.png",
+                    SelectedImagePath = "Floor/FloorSelected.png",
+                    Gravity = Gravity.CenterVertical,
+                };
+                rowFrameLayout.AddChidren(btnAllMethod);
+
+                var btnMethodText = new Button()
+                {
+                    Width = Application.GetRealWidth(311),
+                    Height = Application.GetRealHeight(58),
+                    X = Application.GetRealWidth(92),
+                    Gravity = Gravity.CenterVertical,
+                    TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+                    TextSize = 14,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    Text = dicFloorList[floorId],
+                };
+                rowFrameLayout.AddChidren(btnMethodText);
+
+                if (curControlDev.currentSelectFloorId == floorId)
+                {
+                    btnAllMethod.IsSelected = true;
+                    btnAllMethod.IsBold = true;
+                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                }
+
+                EventHandler<MouseEventArgs> hander = (sender, e) =>
+                {
+                    if (curControlDev.currentSelectFloorId == floorId)
+                    {
+                        return;
+                    }
+                    curControlDev.currentSelectFloorId = floorId;
+
+                    if (!btnMethodText.IsSelected)
+                    {
+                        if (oldbutton != null)
+                        {
+                            oldbutton.IsSelected = false;
+                        }
+                        if (oldbuttonText != null)
+                        {
+                            oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
+                        }
+                        oldbutton = btnMethodText;
+                        oldbuttonText = btnMethodText;
+                        btnMethodText.IsSelected = true;
+                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                        oldbuttonText.IsBold = true;
+                    }
+
+                    int index = 0;
+                    dialog.Close();
+                    ChooseFloorAction?.Invoke(floorId, btnMethodText);
+                };
+                btnAllMethod.MouseUpEventHandler += hander;
+                rowFrameLayout.MouseUpEventHandler += hander;
+                btnMethodText.MouseUpEventHandler += hander;
+                count++;
+            }
+
+            if (count == 0)
+            {
+                sidelipFrameLayout.Height = 0;
+            }
+            else if (count <= 4 && count > 0)
+            {
+                sidelipFrameLayout.Height = Application.GetRealHeight(180) + count * Application.GetRealHeight(150);
+            }
+            else
+            {
+                sidelipFrameLayout.Height = Application.GetMinReal(780);
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0