| | |
| | | |
| | | //public static Button LogoButton = new Button (); |
| | | |
| | | public static string RequestVersion = "20200417"; |
| | | public static string RequestVersion = "20200422"; |
| | | public static UserInfo LoginUser; |
| | | /// <summary> |
| | | /// 是否是管理员权限(变更了,成员的时候,这个也为ture。为什么会声明这样变量,因为有些接口必须使用原来的Token) |
| | |
| | | /// <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; |
| | | }; |
| | |
| | | } 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 (); |
| | | }); |
| | | 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) {/* 如果不需要验证Token可以不用传入 */ |
| | | // 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) { |
| | |
| | | { |
| | | ResponsePack revertObj = null; |
| | | try { |
| | | |
| | | |
| | | ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, error) => { |
| | | return true; |