From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28

---
 ZigbeeApp/Shared/Common/CommonPage.cs |  206 ++++++++-------------------------------------------
 1 files changed, 34 insertions(+), 172 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs
old mode 100755
new mode 100644
index 325dccd..009ba21
--- a/ZigbeeApp/Shared/Common/CommonPage.cs
+++ b/ZigbeeApp/Shared/Common/CommonPage.cs
@@ -7,7 +7,7 @@
 using Shared.Phone.UserCenter.Abount;
 namespace Shared.Common
 {
-    public class CommonPage : FrameLayout
+    public class CommonPage : UIDrawerLayout
     {
         static CommonPage commonPage;
         public static CommonPage Instance
@@ -43,6 +43,11 @@
             Application.MainPage.AddChidren(Loading);
             //}
             Phone.UserView.HomePage.Instance.InitPage();
+
+            var roomList = new Shared.Phone.Device.Room.RoomManagement();
+
+            Instance.AddLeftView(roomList);
+            roomList.Show();
         }
 
         public static string SoftTitle = "ZigBee";
@@ -57,7 +62,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string CodeIDString = "1.0.19111201";
+        public static string CodeIDString = "1.0.20011001";
         /// <summary>
         /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee)
         /// </summary>
@@ -153,9 +158,8 @@
 
         /// <summary>
         /// 鐢ㄤ簬涓浗澶ч檰楠岃瘉鎵嬫満鍙锋鍒欒〃杈惧紡
-        /// 绛夊悓浜�--- "^[1]+\\d{10}"
         /// </summary>
-        public static string PhoneRegexStr = "^[1]+[0,1,2,3,4,5,6,7,8,9]+\\d{9}";
+        public static string PhoneRegexStr = "^[1][0-9]{10}$";
         /// <summary>
         /// 鐢ㄤ簬楠岃瘉闈炰腑鍥藉ぇ闄嗘墜鏈哄彿姝e垯琛ㄨ揪寮�
         /// </summary>
@@ -164,10 +168,7 @@
         /// 鐢ㄤ簬楠岃瘉閭姝e垯琛ㄨ揪寮�
         /// </summary>
         public static string EmailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$";
-        /// <summary>
-        /// 涓嬭浇瀹夊崜apk鐨刡yte闀垮害
-        /// </summary>
-        public static long ApkBytesTotalLength = 0;
+
 
         //public static Encoding EncodingUTF8 = Encoding.UTF8;
         //public static Encoding EncodingGB2312 = Encoding.GetEncoding("gb2312");
@@ -182,8 +183,8 @@
         /// 11
         /// </summary>
         public static int PlaceHolderTextSize = 11;
-        /// <summary>
-        /// 瀹夊崜鐨勭郴缁熻繑鍥炴寜閿兘鍚︽寜涓�(姣斿鍦ㄥ浠借繕鍘熸椂,涓嶈兘鎸変笅杩斿洖閿�)
+        /// <summary>
+        /// 瀹夊崜鐨勭郴缁熻繑鍥炴寜閿兘鍚︽寜涓�(姣斿鍦ㄥ浠借繕鍘熸椂,涓嶈兘鎸変笅杩斿洖閿�)
         /// </summary>
         public static bool BackKeyCanClick = true;
 
@@ -222,9 +223,9 @@
         public async System.Threading.Tasks.Task<string> RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData)
         {
             var result = await RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData);
-            if (result != null)
-            {
-                return Encoding.UTF8.GetString(result);
+            if (result != null)
+            {
+                return Encoding.UTF8.GetString(result);
             }
             return null;
         }
@@ -247,18 +248,18 @@
         /// <summary>
         /// <pra>璇锋眰鏈嶅姟鍣ㄦ柟娉�,鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁</pra>
         /// <pra>娉ㄦ剰!!姝ゆ柟娉曚粎闄愩�愭嫢鏈夌鐞嗗憳鏉冮檺鐨勬垚鍛樸�戣皟鐢�</pra>
-        /// </summary>
+        /// </summary>
         /// <param name="requestUrl">璇锋眰Url</param>
         /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
         /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param>
         /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
         public async System.Threading.Tasks.Task<byte[]> RequestZigbeeHttpsByAdmin(string requestUrl, byte[] byteData, string requestMethod = "POST")
-        {
+        {
             //璇锋眰Url鐨勫畬鎴愯矾寰�
-            var fullUrl = $"{Config.Instance.AdminRequestBaseUrl}/{requestUrl}";
+            var fullUrl = $"{Config.Instance.AdminRequestBaseUrl}/{requestUrl}";
             return await this.DoRequestZigbeeHttpsInterface(fullUrl, byteData, Config.Instance.AdminRequestToken, requestMethod);
         }
-
+
         /// <summary>
         /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
         /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
@@ -268,18 +269,22 @@
         /// <param name="token">token</param>
         /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param>
         /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
-        private async System.Threading.Tasks.Task<byte[]> DoRequestZigbeeHttpsInterface(string requestFullUrl, byte[] byteData, string token, string requestMethod = "POST")
+        public async System.Threading.Tasks.Task<byte[]> DoRequestZigbeeHttpsInterface(string requestFullUrl, byte[] byteData, string token, string requestMethod = "POST")
         {
             try
             {
                 //鍒濆鍖栨柊鐨剋ebRequst
                 //1锛� 鍒涘缓httpWebRequest瀵硅薄
-                HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(requestFullUrl));
+                HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(requestFullUrl));
 
                 //2锛� 鍒濆鍖朒ttpWebRequest瀵硅薄
                 webRequest.Method = requestMethod;
                 webRequest.Timeout = 10 * 1000;
-                webRequest.Headers.Add(HttpRequestHeader.Authorization, token);
+                if (token != null)
+                {
+                    //瀵瑰簲寰俊缃戝潃
+                    webRequest.Headers.Add(HttpRequestHeader.Authorization, token);
+                }
                 if (requestMethod == "GET")
                 {
                     //webRequest.ContentType = "text/html";
@@ -301,7 +306,7 @@
                 var response = (HttpWebResponse)webRequest.GetResponse();
                 using (var stream = response.GetResponseStream())
                 {
-                    if (stream == null)
+                    if (stream == null)
                     {
                         return null;
                     }
@@ -317,157 +322,14 @@
                 }
             }
             catch (Exception e)
-            {
-                System.Console.WriteLine(e.Message);
-                return null;
-            }
-        }
-#if iOS
-        /// <summary>
-        /// 鑾峰彇iOS-APP鐗堟湰淇℃伅
-        /// </summary>
-        /// <returns>The https app version async.</returns>
-        public async System.Threading.Tasks.Task<ResponseEntity.ResultPack> RequestHttpsiOSAppVersionAsync()
-        {
-            try
-            {
-                var webClient = new WebClient { };
-                var result = await webClient.DownloadDataTaskAsync("https://itunes.apple.com/lookup?id=1461693569");
-                if (result == null)
-                {
-                    return null;
-                }
-                return Newtonsoft.Json.JsonConvert.DeserializeObject<ResponseEntity.ResultPack>(Encoding.UTF8.GetString(result));
-            }
-            catch
-            {
-                return null;
-            }
-        }
-        /// <summary>
-        /// 璺宠浆鍒癆PP Store
-        /// </summary>
-        public void OpenUrl()
-        {
-            Uri url = new Uri("https://itunes.apple.com/cn/app/hdl-home/id1461693569?mt=8");
-            UIKit.UIApplication.SharedApplication.OpenUrl(url);
-        }
-#elif Android
-        /// <summary>
-        /// 鑾峰彇 Android-APP 鐗堟湰淇℃伅
-        /// </summary>
-        /// <returns>The https app version async.</returns>
-        public async System.Threading.Tasks.Task<ResponseEntity.ApkInfoOBJ> RequestHttpsAndroidAppVersionAsync()
-        {
-            try
-            {
-                var requestOBJ = new SendDataToServer.GetAndroidApkInfoOBJ
-                {
-                    Name = "ZigbeeApp",
-                    RequestVersion = CodeIDString
-                };
-                var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestOBJ);
-                var result = await RequestHttpsZigbeeAsync("FirmwareMana/DetectionPlatformUploadFirmware", System.Text.Encoding.UTF8.GetBytes(requestJson));
-                if (result == null)
-                {
-                    return null;
-                }
-                if (result.StateCode.ToUpper() == "SUCCESS")
-                {
-                    if (result.ResponseData == null)
-                    {
-                        return null;
-                    }
-
-                    var responeData = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponseEntity.ApkInfoRes>(result.ResponseData.ToString());
-                    if (responeData == null || responeData.pageData == null || responeData.pageData.Count==0)
-                    {
-                        return null;
-                    }
-                    int MaxIndex = 0;
-                    int NewVersion = 0;
-                    for (int i = 0; i < responeData.pageData.Count; i++)
-                    {
-                        var apkInfo = responeData.pageData[i];
-                        var version = int.Parse(apkInfo.FirmwareVersion.Replace(".", ""));
-                        if (version > NewVersion)
-                        {
-                            NewVersion = version;
-                            MaxIndex = i;
-                        }
-                    }
-                    return responeData.pageData[MaxIndex];
-                }
-                return null;
-            }
-            catch (Exception ex)
-            {
-                return null;
-            }
-        }
-
-        /// <summary>
-        /// 涓嬭浇瀹夎apk
-        /// </summary>
-        /// <returns>The load apk async.</returns>
-        /// <param name="requestUrl">璇锋眰閾炬帴</param>
-        /// <param name="byteData">璇锋眰鍙傛暟</param>
-        public System.Threading.Tasks.Task<byte[]> DownLoadApkAsync(string requestUrl, byte[] byteData)
-        {
-            try
-            {
-                AbountForm.instance.webClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");
-                AbountForm.instance.webClient.Headers.Add(HttpRequestHeader.Authorization, Config.Instance.Token);
-                AbountForm.instance.webClient.UploadProgressChanged += Client_DownloadProgressChanged;
-                AbountForm.instance.webClient.UploadDataCompleted += Client_UploadCompleted;
-                var result = AbountForm.instance.webClient.UploadDataTaskAsync($"{RequestHttpsHost}/{requestUrl}", "POST", byteData);
-                if (result == null)
-                {
-                    return null;
-                }
-                return result;
-            }
-            catch (Exception ex)
-            {
-                return null;
-            }
-            finally
-            {
-            }
-        }
-        /// <summary>
-        /// apk涓嬭浇杩涘害
-        /// </summary>
-        /// <param name="sender">Sender.</param>
-        /// <param name="e">E.</param>
-        void Client_DownloadProgressChanged(object sender, UploadProgressChangedEventArgs e)
-        {
-            System.Console.WriteLine($"褰撳墠杩涘害--{(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)} % --BytesReceived--{e.BytesReceived}--totalByte{e.TotalBytesToReceive}");
-            if (e.BytesReceived <= ApkBytesTotalLength)
-            {
-                Application.RunOnMainThread(() =>
-                {
-                    //Loading.Start($"{(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)} %");
-                    AbountForm.instance.seekBar.Progress = (int)(e.BytesReceived / (float)ApkBytesTotalLength * 100);
-                    AbountForm.instance.seekBarTitle.Text = $"{(int)(e.BytesReceived / (float)ApkBytesTotalLength * 100)}%";
-                });
-            }
-        }
-        void Client_UploadCompleted(object sender, UploadDataCompletedEventArgs e)
-        {
-            System.Console.WriteLine("涓嬭浇apk瀹屾垚");
-            //Application.RunOnMainThread(Loading.Hide);
-        }
-        /// <summary>
-        /// 鍙栨秷涓嬭浇apk
-        /// </summary>
-        public static void CancelDownLoadApkAsync()
-        {
-            AbountForm.instance.webClient?.CancelAsync();
-            System.Console.WriteLine("鍙栨秷涓嬭浇apk");
-        }
-
+            {
+#if DEBUG
+                System.Console.WriteLine(e.Message);
 #endif
+                return null;
+            }
+        }
+
         /// <summary>
         /// 鏈嶅姟鍣ㄨ幏鍙栨暟鎹け璐ユ彁绀�
         /// </summary>
@@ -527,7 +389,7 @@
         {
             try
             {
-                Application.RunOnMainThread( () =>
+                Application.RunOnMainThread(() =>
                 {
                     //璁惧畾涓�涓椂闂�
                     Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);

--
Gitblit v1.8.0