From c1de48884fa145a16a0f8bcee93274dcfaa0ff82 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 07 五月 2020 10:40:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-2020xm

---
 ZigbeeApp/Shared/Phone/Login/PhoneZone.cs |  281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 281 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Login/PhoneZone.cs b/ZigbeeApp/Shared/Phone/Login/PhoneZone.cs
new file mode 100755
index 0000000..13a0844
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Login/PhoneZone.cs
@@ -0,0 +1,281 @@
+锘縰sing System;
+using System.Collections.Generic;
+using Shared.Common;
+
+namespace Shared.Phone.Device.Login
+{
+    public class PhoneZone : UserCenter.FrameLayoutBase
+    {
+        #region 鈼� 鍙橀噺____________________________
+        /// <summary>
+        /// 閫夋嫨鐨勫尯鍙�
+        /// </summary>
+        public Action<string> ActionSelectedZone;
+        /// <summary>
+        /// *****鍗囩骇鍒嗗竷寮忓悗锛孉ccount 浠呭寘鍚墜鏈哄彿锛屼笉鍐嶅寘鍚�00鍖哄彿銆傚瘑鐮佷笉鍐嶉渶瑕丮D5鍔犲瘑銆俵anguage涓篈PP璇�
+        /// 涓嬫潵閫夋嫨鎵嬫満鍖哄彿 榛樿涓浗澶ч檰涓�86
+        ///鍙戦�佸浗闄� / 娓境鍙版秷鎭椂锛屾帴鏀跺彿鐮佹牸寮忎负00 + 鍥介檯鍖哄彿 + 鍙风爜锛屽鈥�008615899998888鈥�   璋冪敤API鏃讹紝Company瀛楁璇蜂紶鍏ユ暣鍨嬪�硷細4銆� 銆�
+        ///鍥藉唴  璋冪敤API鏃讹紝Company瀛楁璇蜂紶鍏ユ暣鍨嬪�硷細0銆�
+        /// </summary>
+        public List<Common.ResponseEntity.AreaCodeOBJ> areaCodeList = new List<Common.ResponseEntity.AreaCodeOBJ>();
+        /// <summary>
+        /// 閫夋嫨鍖哄彿瑙嗗浘
+        /// </summary>
+        private FrameLayout phoneZoneSelectedShowView;
+        /// <summary>
+        /// 鍖哄彿瑙嗗浘
+        /// </summary>
+        private VerticalScrolViewLayout phoneZoneListView;
+		/// <summary>
+		/// tempClickZoneCodeBtn
+		/// </summary>
+		Button tempClickZoneCodeBtn = new Button();
+		/// <summary>
+		/// tempClickZoneNameBtn
+		/// </summary>
+		Button tempClickZoneNameBtn = new Button();
+		/// <summary>
+		/// tempClickZoneItemFL
+		/// </summary>
+		FrameLayout tempClickZoneItemFL = new FrameLayout();
+        #endregion
+        /// <summary>
+        /// PhoneZone
+        /// </summary>
+        public PhoneZone()
+        {
+
+        }
+		/// <summary>
+		/// Show
+		/// </summary>
+		public void Show()
+        {
+            Init();
+        }
+		/// <summary>
+		/// Init
+		/// </summary>
+		private void Init()
+        {
+            CommonPage.Loading.Start();
+            ShowZoneList();
+			new System.Threading.Thread(async () =>
+			{
+				var zoneList = await GetZoneListAsync();
+				if (zoneList == null)
+				{
+					Application.RunOnMainThread(() =>
+					{
+						CommonPage.Loading.Hide();
+
+					});
+				}
+				else
+				{
+					Application.RunOnMainThread(() =>
+					{
+						foreach (var areaCode in zoneList)
+						{
+							AddZone(areaCode, phoneZoneListView);
+						}
+						CommonPage.Loading.Hide();
+					});
+				}
+			})
+			{ IsBackground = true }.Start();
+        }
+        /// <summary>
+        /// GetZoneListAsync
+        /// </summary>
+        /// <returns></returns>
+        private async System.Threading.Tasks.Task<List<Common.ResponseEntity.AreaCodeOBJ>> GetZoneListAsync()
+        {
+            try
+            {
+                var requestOBJ = new SendDataToServer.GetAreaCodeOBJ()
+                {
+                    RequestVersion = CommonPage.RequestVersion
+                };
+                var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestOBJ);
+                var revertOBJ = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/GetAreaCode", System.Text.Encoding.UTF8.GetBytes(requestJson));
+                if (revertOBJ == null)
+                {
+                    return null;
+                }
+                if (revertOBJ.StateCode.ToUpper() == "SUCCESS")
+                {
+
+                    var responseData = revertOBJ.ResponseData;
+                    return Newtonsoft.Json.JsonConvert.DeserializeObject<List<Common.ResponseEntity.AreaCodeOBJ>>(responseData.ToString());
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            catch
+            {
+                return null;
+            }
+        }
+		/// <summary>
+		/// ShowZoneList
+		/// </summary>
+		private void ShowZoneList()
+        {
+            //ZoneListView
+            var phoneZoneDialog = new FrameLayout()
+            {
+                BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
+            };
+            AddChidren(phoneZoneDialog);
+
+            phoneZoneSelectedShowView = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(1342),
+                Width = Application.GetRealWidth(850),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
+                Radius = (uint)Application.GetRealHeight(30),
+                Gravity = Gravity.Center
+            };
+            phoneZoneDialog.AddChidren(phoneZoneSelectedShowView);
+
+            var phoneZoneTitle = new Button()
+            {
+                X = Application.GetRealWidth(CommonPage.XLeft),
+                Y = Application.GetRealHeight(69),
+                Height = Application.GetRealHeight(60),
+                Width = Application.GetRealWidth(250),
+                TextID = R.MyInternationalizationString.PleaseSelectAreaCode,
+                TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor,
+                TextAlignment = TextAlignment.CenterLeft
+            };
+            phoneZoneSelectedShowView.AddChidren(phoneZoneTitle);
+
+            var searchBorder = new FrameLayout()
+            {
+                X = phoneZoneTitle.Right + Application.GetRealWidth(CommonPage.XLeft),
+                Y = Application.GetRealHeight(46),
+                Height = Application.GetRealHeight(104),
+                Width = Application.GetRealWidth(400),
+                BorderWidth = 1,
+                BorderColor = ZigbeeColor.Current.GXCBorderColor,
+                Radius = (uint)Application.GetRealHeight(46 / 2)
+            };
+            phoneZoneSelectedShowView.AddChidren(searchBorder);
+
+            var phoneZoneSearch = new EditText()
+            {
+                X = phoneZoneTitle.Right + Application.GetRealWidth(CommonPage.XLeft + 10),
+                Y = Application.GetRealHeight(46),
+                Height = Application.GetRealHeight(104),
+                Width = Application.GetRealWidth(400),
+                PlaceholderText = Language.StringByID(R.MyInternationalizationString.Search),
+                PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
+                TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor
+            };
+            phoneZoneSelectedShowView.AddChidren(phoneZoneSearch);
+
+            phoneZoneListView = new VerticalScrolViewLayout()
+            {
+                Y = phoneZoneSearch.Bottom + Application.GetRealHeight(10),
+                Height = Application.GetRealHeight(986),
+            };
+            phoneZoneSelectedShowView.AddChidren(phoneZoneListView);
+
+            var btnOk = new UserCenter.BottomClickButton(668);
+            btnOk.Y = Application.GetRealHeight(1166);
+            btnOk.TextID = R.MyInternationalizationString.Complete;
+            phoneZoneSelectedShowView.AddChidren(btnOk);
+            btnOk.ButtonClickEvent += (sender, e) =>
+            {
+                ActionSelectedZone?.Invoke(CommonPage.PhoneZoneStr);
+                ActionSelectedZone = null;
+                RemoveFromParent();
+            };
+            var cancleBtn = new Button()
+            {
+                Y = Application.GetRealHeight(1719),
+                Height = this.GetPictrueRealSize(86),
+                Width = this.GetPictrueRealSize(86),
+                UnSelectedImagePath = "Account/Cancle.png",
+                Gravity = Gravity.CenterHorizontal
+            };
+            phoneZoneDialog.AddChidren(cancleBtn);
+
+            cancleBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                this.RemoveFromParent();
+            };
+        }
+		/// <summary>
+		/// AddZone
+		/// </summary>
+		/// <param name="areaCode"></param>
+		/// <param name="phoneZoneSelectedListView"></param>
+		private void AddZone(Common.ResponseEntity.AreaCodeOBJ areaCode, VerticalScrolViewLayout phoneZoneSelectedListView)
+        {
+            var zoneItemLName = areaCode.Name;
+            var zoneItemLCode = areaCode.Code;
+            var zoneItemFL = new FrameLayout()
+            {
+                Width = phoneZoneSelectedListView.Width,
+                Height = Application.GetRealHeight(110),
+            };
+            phoneZoneSelectedListView.AddChidren(zoneItemFL);
+
+            var zoneItemNameBtn = new Button()
+            {
+                X = Application.GetRealWidth(58),
+                Width = zoneItemFL.Width - Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(110) - 1,
+                Text = zoneItemLName,
+                TextColor = ZigbeeColor.Current.GXCTextColor,
+                SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            zoneItemFL.AddChidren(zoneItemNameBtn);
+
+            var zoneCode = new Button()
+            {
+                X = Application.GetRealWidth(58) + zoneItemNameBtn.Right,
+                Width = Application.GetRealWidth(150),
+                Height = Application.GetRealHeight(80),
+                Gravity = Gravity.CenterVertical,
+                Text = $"+{zoneItemLCode}",
+                TextAlignment = TextAlignment.CenterRight,
+                TextColor = ZigbeeColor.Current.GXCTextColor,
+                SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
+            };
+            zoneItemFL.AddChidren(zoneCode);
+
+            EventHandler<MouseEventArgs> selectedZone = (sender, e) =>
+            {
+                tempClickZoneCodeBtn.IsSelected = false;
+                tempClickZoneNameBtn.IsSelected = false;
+                tempClickZoneItemFL.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+                zoneItemNameBtn.IsSelected = true;
+                zoneCode.IsSelected = true;
+                tempClickZoneCodeBtn = zoneCode;
+                tempClickZoneNameBtn = zoneItemNameBtn;
+                tempClickZoneItemFL = zoneItemFL;
+                zoneItemFL.BackgroundColor = ZigbeeColor.Current.GXCRowSelectedColor;
+                CommonPage.PhoneZoneStr = zoneItemLCode;
+            };
+
+            zoneCode.MouseUpEventHandler += selectedZone;
+            zoneItemNameBtn.MouseUpEventHandler += selectedZone;
+            //榛樿
+            if (zoneItemLCode == CommonPage.PhoneZoneStr)
+            {
+                zoneItemNameBtn.IsSelected = true;
+                zoneCode.IsSelected = true;
+                zoneItemFL.BackgroundColor = ZigbeeColor.Current.GXCRowSelectedColor;
+                tempClickZoneCodeBtn = zoneCode;
+                tempClickZoneNameBtn = zoneItemNameBtn;
+                tempClickZoneItemFL = zoneItemFL;
+            }
+        }
+    }
+}

--
Gitblit v1.8.0