From 0e1c6c25b1b0961d324811ff2132717a80f99efe Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期日, 26 四月 2020 14:15:05 +0800 Subject: [PATCH] 2020-04-26 1.添加住宅和修改住宅时,改为子线程操作。 2.远程连接模式时,禁用搜索网关和添加设备。3.修复切换住宅时,提示远程连接Loading不关闭问题。 --- Crabtree/SmartHome/UI/SimpleControl/MainPage.cs | 60 ++++++++++++++++-------------------------------------------- 1 files changed, 16 insertions(+), 44 deletions(-) diff --git a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs index 1c03c83..1f245cc 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/MainPage.cs @@ -36,8 +36,9 @@ } //public static Button LogoButton = new Button (); + - public static string RequestVersion = "20200402"; + public static string RequestVersion = "20200426"; public static UserInfo LoginUser; /// <summary> /// 鏄惁鏄鐞嗗憳鏉冮檺(鍙樻洿浜�,鎴愬憳鐨勬椂鍊�,杩欎釜涔熶负ture銆備负浠�涔堜細澹版槑杩欐牱鍙橀噺,鍥犱负鏈変簺鎺ュ彛蹇呴』浣跨敤鍘熸潵鐨凾oken) @@ -166,11 +167,13 @@ Gravity = Gravity.Center, Width = Application.GetRealWidth (560), Height = Application.GetRealHeight (126), - BackgroundColor = SkinStyle.Current.AddTipButtonColor, + //BackgroundColor = SkinStyle.Current.AddTipButtonColor, + BackgroundColor = SkinStyle.Current.MainColor, Radius = 10, IsMoreLines = true, Text = tip, TextSize = 16, + TextColor = 0xFF000000 }; MainFrameLayout.AddChidren (button); button.MouseUpEventHandler += (sender, e) => { @@ -196,28 +199,6 @@ /// <param name="needHeaders">鏄惁闇�瑕佸寘澶�.</param> public static ResponsePack RequestHttps (string methodType, string dataStringJson, string urlHead = "") { - //2020-01-08 灞忚斀 - //if (!SystemRemote.checeInternet ()) { - // Application.RunOnMainThread (() => { - // MainPage.WiFiStatus = "CrabtreeAdd/WiFiUnlink.png"; - // MainPage.Loading.Hide (); - // }); - //} - //new System.Threading.Thread (() => { - // requesTime = DateTime.Now; - // isShowLoading = true; - // while (isShowLoading) { - // System.Threading.Thread.Sleep (1000); - // if (requesTime == DateTime.MinValue) { - // break; - // } - // if (requesTime.AddSeconds (30) < DateTime.Now) { - // Application.RunOnMainThread (Loading.Hide); - // isShowLoading = false; - // } - // } - //}) { IsBackground = true }.Start (); - ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, error) => { return true; }; @@ -239,28 +220,13 @@ try { bytes = webClient.UploadData (url, Encoding.UTF8.GetBytes (dataStringJson)); } catch (System.Net.WebException webEx) { - Application.RunOnMainThread (() => { - MainPage.Loading.Hide (); - //new Alert ( "","Network abnormal, unable to connect to the Internet", Language.StringByID (R.MyInternationalizationString.Close)).Show (); - }); + //Application.RunOnMainThread (() => { + // MainPage.Loading.Hide (); + //}); return new ResponsePack () { StateCode = ErrorCode.NetworkError }; } string responseString = Encoding.UTF8.GetString (bytes); - //var DD = Newtonsoft.Json.Linq.JObject .Parse("GFGFDG");DD["ResponseData"]["PageData"] - - //var request = (HttpWebRequest)WebRequest.Create (url); - //var data = Encoding.UTF8.GetBytes (dataStringJson); - //request.Method = "POST"; - //request.ContentLength = data.Length; - //if (needHeaders) {/* 濡傛灉涓嶉渶瑕侀獙璇乀oken鍙互涓嶇敤浼犲叆 */ - // request.Headers.Set (HttpRequestHeader.Authorization, LoginUser.LoginTokenString); - //} - //using (var stream = request.GetRequestStream ()) { - // stream.Write (data, 0, data.Length); - //} - //var response = (HttpWebResponse)request.GetResponse (); - //var responseString = new StreamReader (response.GetResponseStream ()).ReadToEnd (); - + try { return Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack> (responseString); } catch (Exception ex) { @@ -282,7 +248,6 @@ { ResponsePack revertObj = null; try { - ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, error) => { return true; @@ -362,6 +327,13 @@ }); } + public static void LoadingSetText (string showString = "") + { + Application.RunOnMainThread (() => { + MainPage.Loading.Text = showString; + }); + } + public static void LoadingHide () { Application.RunOnMainThread (() => { -- Gitblit v1.8.0