From 652243206427f35a256400a149a1734085824cb9 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 02 九月 2020 17:35:03 +0800
Subject: [PATCH] 2020-09-02-4

---
 ZigbeeApp/Shared/Common/CommonPage.cs |  432 ++++++++++++++++-------------------------------------
 1 files changed, 135 insertions(+), 297 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs
old mode 100644
new mode 100755
index 06afe41..d72d0b2
--- a/ZigbeeApp/Shared/Common/CommonPage.cs
+++ b/ZigbeeApp/Shared/Common/CommonPage.cs
@@ -4,10 +4,10 @@
 using System.Linq;
 using System.Net;
 using System.Text;
-using Shared.Phone.UserCenter.Abount;
+
 namespace Shared.Common
 {
-    public class CommonPage : FrameLayout
+    public class CommonPage : UIDrawerLayout
     {
         static CommonPage commonPage;
         public static CommonPage Instance
@@ -28,36 +28,21 @@
         public static Loading Loading = new Loading();
         public void Show()
         {
-            //if (Application.IsPad)
-            //{
-            //    Application.DesignWidth = 2048;
-            //    Application.DesignHeight = 1536;
-            //    Pad.MainPage.Instance .Show();
-            // }
-            //else
-            //{
             Application.DesignWidth = 1080;
             Application.DesignHeight = 1920;
             Application.MainPage.AddChidren(this);
             AddChidren(Phone.UserView.HomePage.Instance);
             Application.MainPage.AddChidren(Loading);
-            //}
+
             Phone.UserView.HomePage.Instance.InitPage();
         }
 
-        public static string SoftTitle = "ZigBee";
-        /// <summary>
-        /// 鐭俊妯℃澘缂栧彿
-        /// </summary>
-        public static int SoftSmsType = 0;
-        public static string LogoString = @"Logo/Logo.png";
-        public static string RegisterLogoString = @"Logo/Register_logo.png";
-        public static string RequestHttpsHost = "https://global.hdlcontrol.com/HangZhouHdlCloudApi";
-        //public static string RequestHttpsHost = "http://172.16.2.225:13061";
+        //public static string RequestHttpsHost = "https://global.hdlcontrol.com/HangZhouHdlCloudApi";
+        public static string RequestHttpsHost = "https://global.hdlcontrol.com/ProposedProductionApi";
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string CodeIDString = "1.0.19071001";
+        public static string CodeIDString = "1.1.0120082701";
         /// <summary>
         /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee)
         /// </summary>
@@ -74,15 +59,11 @@
         /// <summary>
         /// 璇锋眰鐗堟湰鍙�
         /// </summary>
-        public static string RequestVersion = "1.0";
+        public static string RequestVersion = "2.0";
         /// <summary>
-        /// 宸﹁竟璺濈灞忓箷鐨勫搴�--50
+        /// 宸﹁竟璺濈灞忓箷鐨勫搴�--58
         /// </summary>
-        public static int XLeft = 50;
-        /// <summary>
-        /// button楂樺害--110
-        /// </summary>
-        public static int ButtonHeight = 110;
+        public static int XLeft = 58;
         /// <summary>
         /// 浣跨敤鐨勮瑷�
         /// </summary>
@@ -94,68 +75,18 @@
             }
         }
         /// <summary>
-        /// 澶ф帶浠跺渾瑙� --- 10銆備笉鏄笉鍗婂渾閭g銆�
-        /// </summary>
-        public static uint BigFormRadius = 10;
-        /// <summary>
         /// 榛樿鎵嬫満鍖哄彿涓�86涓浗澶ч檰
         /// </summary>
         public static string PhoneZoneStr = "86";
         /// <summary>
-        /// 鎵嬫満鍖哄悕绉�
-        /// </summary>
-        public static string ZoneNameStr = "涓浗澶ч檰";
-        /// <summary>
-        /// 璺濈椤剁楂樺害--80 鐘舵�佹爮楂樺害
-        /// </summary>
-        public static int NavigationTitle_Y = 80;
-        /// <summary>
-        /// 琛岄珮--180
-        /// </summary>
-        public static int RowHeight = 180;
-        /// <summary>
         /// APP瀹藉害 -- 1080
         /// </summary>
         public static int AppRealWidth = 1080;
-        /// <summary>
-        /// APP楂樺害 -- 1920
-        /// </summary>
-        public static int AppRealHeight = 1920;
-        /// <summary>
-        /// 杩斿洖閿窛绂诲乏杈圭殑璺濈 30
-        /// </summary>
-        public static int Navigation_X = 30;
-        /// <summary>
-        /// 瀵艰埅鏍忛珮搴�-220
-        /// </summary>
-        public static int Navigation_Height = 220;
-        /// <summary>
-        /// 搴曡竟鏍忛珮搴� 160
-        /// </summary>
-        public static int TabbarHeight = 160;
-        /// <summary>
-        /// 绾挎潯鐨勯珮搴�--瀹為檯鍍忕礌3
-        /// </summary>
-        public static int LineHeight = 3;
-        /// <summary>
-        /// 鏁翠釜鍦烘櫙寤舵椂鏃堕棿--60绉�
-        /// </summary>
-        public static int SceneDelayTime = 60;
-
-        /// <summary>
-        /// 闂撮殧澶氶暱鏃堕棿璇诲彇璁惧鐘舵�� 鍗曚綅 绉� --榛樿30
-        /// </summary>
-        public static int ReadDeviceStatuSpan = 30;
-        /// <summary>
-        /// 璇诲彇澶氬皯椤�--999
-        /// </summary>
-        public static int PageSize = 999;
 
         /// <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,21 +95,10 @@
         /// 鐢ㄤ簬楠岃瘉閭姝e垯琛ㄨ揪寮�
         /// </summary>
         public static string EmailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$";
-        /// <summary>
-        /// 涓嬭浇瀹夊崜apk鐨刡yte闀垮害
+        /// <summary>
+        /// 瀹夊崜鐨勭郴缁熻繑鍥炴寜閿兘鍚︽寜涓�(姣斿鍦ㄥ浠借繕鍘熸椂,涓嶈兘鎸変笅杩斿洖閿�)
         /// </summary>
-        public static long ApkBytesTotalLength = 0;
-
-        //public static Encoding EncodingUTF8 = Encoding.UTF8;
-        //public static Encoding EncodingGB2312 = Encoding.GetEncoding("gb2312");
-        public static bool IsRemote = false;
-        public static bool FindGateway = false;
-        /// <summary>
-        /// 褰撳墠缃戠粶杩炴帴鐨勬ā寮�  0:娌℃湁缃戠粶  1锛氳繙绋嬭繛鎺ワ紝涔熷彨3G,4G  2锛歐IFI
-        /// </summary>
-        public static int nowNetworkMode = 0;
-
-
+        public static bool BackKeyCanClick = true;
 
         /// <summary>
         /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
@@ -186,10 +106,11 @@
         /// </summary>
         /// <param name="requestUrl">璇锋眰Url</param>
         /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <param name="timeout">瓒呮椂,榛樿10绉�</param>
         /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
-        public async System.Threading.Tasks.Task<Shared.Common.ResponseEntity.ResponsePack> RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData)
+        public ResponseEntity.ResponsePack RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData, int timeout = 10)
         {
-            string result = await this.RequestHttpsZigbeeResultAsync(requestUrl, byteData);
+            string result = this.RequestHttpsZigbeeResultAsync(requestUrl, byteData, timeout);
             if (result != null)
             {
                 try
@@ -211,13 +132,14 @@
         /// </summary>
         /// <param name="requestUrl">璇锋眰Url</param>
         /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <param name="timeout">瓒呮椂,榛樿10绉�</param>
         /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
-        public async System.Threading.Tasks.Task<string> RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData)
+        public string RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData, int timeout = 10)
         {
-            var result = await RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData);
-            if (result != null)
-            {
-                return Encoding.UTF8.GetString(result);
+            var result = RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData, "POST", timeout);
+            if (result != null)
+            {
+                return Encoding.UTF8.GetString(result);
             }
             return null;
         }
@@ -228,39 +150,82 @@
         /// </summary>
         /// <param name="requestUrl">璇锋眰Url</param>
         /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param>
+        /// <param name="timeout">瓒呮椂,榛樿10绉�</param>
         /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
-        public async System.Threading.Tasks.Task<byte[]> RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData)
+        public byte[] RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST", int timeout = 10)
         {
+            //璇锋眰Url鐨勫畬鎴愯矾寰�
+            var fullUrl = $"{RequestHttpsHost}/{requestUrl}";
+            return this.DoRequestZigbeeHttpsInterface(fullUrl, byteData, Config.Instance.Token, requestMethod, timeout);
+        }
+
+        /// <summary>
+        /// <pra>璇锋眰鏈嶅姟鍣ㄦ柟娉�,鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁</pra>
+        /// <pra>娉ㄦ剰!!姝ゆ柟娉曚粎闄愩�愭嫢鏈夌鐞嗗憳鏉冮檺鐨勬垚鍛樸�戣皟鐢�</pra>
+        /// </summary>
+        /// <param name="requestUrl">璇锋眰Url</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param>
+        /// <param name="timeout">瓒呮椂,榛樿10绉�</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public byte[] RequestZigbeeHttpsByAdmin(string requestUrl, byte[] byteData, string requestMethod = "POST", int timeout = 10)
+        {
+            //璇锋眰Url鐨勫畬鎴愯矾寰�
+            var fullUrl = $"{Config.Instance.AdminRequestBaseUrl}/{requestUrl}";
+            return this.DoRequestZigbeeHttpsInterface(fullUrl, byteData, Config.Instance.AdminRequestToken, requestMethod, timeout);
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
+        /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
+        /// </summary>
+        /// <param name="requestFullUrl">璇锋眰Url鐨勫畬鎴愯矾寰�</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <param name="token">token</param>
+        /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param>
+        /// <param name="timeout">瓒呮椂,榛樿10绉�</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public byte[] DoRequestZigbeeHttpsInterface(string requestFullUrl, byte[] byteData, string token, string requestMethod = "POST", int timeout = 10)
+        {
             try
             {
                 //鍒濆鍖栨柊鐨剋ebRequst
                 //1锛� 鍒涘缓httpWebRequest瀵硅薄
-                HttpWebRequest webRequest = null;
-                if (Config.Instance.isAdministrator == true)
-                {
-                    webRequest = (HttpWebRequest)WebRequest.Create(new Uri($"{Config.Instance.AdminRequestBaseUrl}/{requestUrl}"));
-                }
-                else
-                {
-                    webRequest = (HttpWebRequest)WebRequest.Create(new Uri($"{RequestHttpsHost}/{requestUrl}"));
-                }
+                HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(requestFullUrl));
+
                 //2锛� 鍒濆鍖朒ttpWebRequest瀵硅薄
-                webRequest.Method = "POST";
-                webRequest.ContentType = "application/json";
-                webRequest.Timeout = 10*1000;
-                webRequest.ContentLength = byteData.Length;
-                webRequest.Timeout = 10*1000;
-                webRequest.Headers.Add(HttpRequestHeader.Authorization, Config.Instance.Token);
-                //3锛� 闄勫姞瑕丳OST缁欐湇鍔″櫒鐨勬暟鎹埌HttpWebRequest瀵硅薄(闄勫姞POST鏁版嵁鐨勮繃绋嬫瘮杈冪壒娈婏紝瀹冨苟娌℃湁鎻愪緵涓�涓睘鎬х粰鐢ㄦ埛瀛樺彇锛岄渶瑕佸啓鍏ttpWebRequest瀵硅薄鎻愪緵鐨勪竴涓猻tream閲岄潰銆�)
-                var newStream = webRequest.GetRequestStream();//鍒涘缓涓�涓猄tream,璧嬪�兼槸鍐欏叆HttpWebRequest瀵硅薄鎻愪緵鐨勪竴涓猻tream閲岄潰
-                newStream.Write(byteData, 0, byteData.Length);
-                newStream.Flush();
-                newStream.Close();
+                webRequest.Method = requestMethod;
+                webRequest.Timeout = timeout * 1000;
+                //鍙栨秷浣跨敤浠g悊璁块棶
+                webRequest.Proxy = null;
+                if (token != null)
+                {
+                    //瀵瑰簲寰俊缃戝潃
+                    webRequest.Headers.Add(HttpRequestHeader.Authorization, token);
+                }
+                if (requestMethod == "GET")
+                {
+                    //webRequest.ContentType = "text/html";
+                    webRequest.ContentType = "application/json";
+                }
+                else
+                {
+                    webRequest.ContentType = "application/json";
+                    webRequest.ContentLength = byteData.Length;
+
+                    //3锛� 闄勫姞瑕丳OST缁欐湇鍔″櫒鐨勬暟鎹埌HttpWebRequest瀵硅薄(闄勫姞POST鏁版嵁鐨勮繃绋嬫瘮杈冪壒娈婏紝瀹冨苟娌℃湁鎻愪緵涓�涓睘鎬х粰鐢ㄦ埛瀛樺彇锛岄渶瑕佸啓鍏ttpWebRequest瀵硅薄鎻愪緵鐨勪竴涓猻tream閲岄潰銆�)
+                    var newStream = webRequest.GetRequestStream();//鍒涘缓涓�涓猄tream,璧嬪�兼槸鍐欏叆HttpWebRequest瀵硅薄鎻愪緵鐨勪竴涓猻tream閲岄潰
+                    newStream.Write(byteData, 0, byteData.Length);
+                    newStream.Flush();
+                    newStream.Close();
+                }
+
                 //4锛� 璇诲彇鏈嶅姟鍣ㄧ殑杩斿洖淇℃伅
                 var response = (HttpWebResponse)webRequest.GetResponse();
                 using (var stream = response.GetResponseStream())
                 {
-                    if(stream==null)
+                    if (stream == null)
                     {
                         return null;
                     }
@@ -275,159 +240,22 @@
                     return ms.ToArray();
                 }
             }
+            catch (WebException e)
+            {
+                if (e.Status == WebExceptionStatus.ConnectFailure//鐢辨湁缃戠粶鍒囨崲鍒版棤缃戠粶鏃惰Е鍙�
+                    || e.Status == WebExceptionStatus.Timeout//瓒呮椂
+                    || e.Status == WebExceptionStatus.NameResolutionFailure)//鏈韩灏辨槸鏃犵綉缁滄椂鍚姩鏃惰Е鍙�
+                {
+                    Phone.UserCenter.HdlWifiLogic.Current.CanAccessHttp = false;
+                }
+                return null;
+            }
             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 NewID = 0;
-                    for (int i = 0; i < responeData.pageData.Count; i++)
-                    {
-                        var apkInfo = responeData.pageData[i];
-                        if (int.Parse(apkInfo.Id) > NewID)
-                        {
-                            NewID = int.Parse(apkInfo.Id);
-                            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");
-        }
-
-#endif
         /// <summary>
         /// 鏈嶅姟鍣ㄨ幏鍙栨暟鎹け璐ユ彁绀�
         /// </summary>
@@ -477,30 +305,30 @@
                     }
                 }
             }
+        }
+
+        /// <summary>
+        /// 鐧诲嚭
+        /// </summary>
+        public void SingOut()
+        {
+            try
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    //璁惧畾涓�涓椂闂�
+                    Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
+                    Config.Instance.Save();
+                    CommonPage.Instance.RemoveAll();
+                    CommonPage.Instance.Show();
+                    var login = new Phone.Login.AccountLoginForm();
+                    CommonPage.Instance.AddChidren(login);
+                    login.ShowForm();
+                });
+            }
+            catch { }
         }
 
-
-        /// <summary>
-        /// 鐧诲嚭
-        /// </summary>
-        public void SingOut()
-        {
-            try
-            {
-                Application.RunOnMainThread( () =>
-                {
-                    //璁惧畾涓�涓椂闂�
-                    Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
-                    Config.Instance.Save();
-                    CommonPage.Instance.RemoveAll();
-                    CommonPage.Instance.Show();
-                    var login = new Phone.Device.Account.AccountLogin();
-                    CommonPage.Instance.AddChidren(login);
-                    login.Show();
-                });
-            }
-            catch { }
-        }
         /// <summary>
         /// 閫�鍑虹櫥褰曟椂璋冪敤锛屾竻闄ゆ帹閫佹暟鎹�
         /// </summary>
@@ -525,8 +353,12 @@
         /// 鐧诲綍鎴愬姛鍚庝笂鎶ヨ澶噄d绛夌浉鍏充俊鎭粰鍚庣
         /// </summary>
         /// <returns>杩斿洖鐘舵�佺爜</returns>
-        public async System.Threading.Tasks.Task<string> PushRegID()
+        public string PushRegID()
         {
+#if DEBUG
+            //璋冭瘯涓嶉渶瑕佸彂閫佽繖涓笢瑗�
+            return null;
+#endif
             try
             {
                 string deviceAlias;
@@ -536,8 +368,9 @@
                 deviceType = "iphone";
 #elif Android
                 deviceAlias = Android.OS.Build.Manufacturer;
-                deviceType = "android";
-#endif
+                deviceType = "android";
+#endif
+
                 var RegIDObj = new SendDataToServer.SignZigbeeNeedPushRegIDObj()
                 {
                     RegID = Shared.Common.Config.Instance.RegistrationID,
@@ -545,11 +378,16 @@
                     DeviceType = deviceType
                 };
                 var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(RegIDObj);
-                var reverObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/SignZigbeeNeedPushRegID", System.Text.Encoding.UTF8.GetBytes(requestJson));
+                var reverObj = CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/SignZigbeeNeedPushRegID", System.Text.Encoding.UTF8.GetBytes(requestJson), 4);
                 if (reverObj == null)
-                {
+                {
+                    //璋冭瘯:璁板綍鏋佸厜ID
+                    Phone.UserCenter.HdlLogLogic.Current.WriteOtherText(Shared.Phone.UserCenter.DirNameResourse.JiguangFile, "send:" + RegIDObj.RegID + " fail,receive obj is null", false, true);
                     return null;
-                }
+                }
+                //璋冭瘯:璁板綍鏋佸厜ID
+                Phone.UserCenter.HdlLogLogic.Current.WriteOtherText(Shared.Phone.UserCenter.DirNameResourse.JiguangFile, "send:" + RegIDObj.RegID + " result:" + reverObj.StateCode, false, true);
+
                 return reverObj.StateCode;
             }
             catch

--
Gitblit v1.8.0