| | |
| | | } |
| | | return loading; |
| | | } |
| | | } |
| | | } |
| | | |
| | | //public static Button LogoButton = new Button (); |
| | | |
| | | public static string CodeIDString = "20191223"; |
| | | public static string CodeIDString = "20220112"; |
| | | public static UserInfo LoginUser; |
| | | |
| | | |
| | |
| | | //Pad.UserHomePage.Init (); |
| | | } else { |
| | | Phone.UserHomePage.Init (); |
| | | #if __IOS__ |
| | | //Loading.LodingBackgroundColor = 0x10777777; |
| | | #else |
| | | //#if __IOS__ |
| | | // //Loading.LodingBackgroundColor = 0x10777777; |
| | | //#else |
| | | // Loading.LodingBackgroundColor = SkinStyle.Current.MainColor; |
| | | //#endif |
| | | |
| | | Loading.TextColor = 0xFFA9A9A9; |
| | | Loading.LodingBackgroundColor = SkinStyle.Current.MainColor; |
| | | #endif |
| | | } |
| | | } catch (Exception ex) { |
| | | //new Alert ("Eorr", ex.Message, "Close").Show(); |
| | |
| | | /// <param name="methodType">请求方法.</param> |
| | | /// <param name="dataStringJson">请求的参数.</param> |
| | | /// <param name="needHeaders">是否需要包头.</param> |
| | | public static ResponsePack RequestHttps (string methodType, string dataStringJson, bool needHeaders = true, bool needTip = true) |
| | | public static ResponsePack RequestHttps (string methodType, string dataStringJson, bool needHeaders = true, bool needTip = true,string urlHead = "") |
| | | { |
| | | ResponsePack revertObj = null; |
| | | try { |
| | |
| | | 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 (); |
| | | //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 (); |
| | | |
| | | |
| | | #region |
| | | string urlHead = $"{"https://homeautomation.havells.com"}/WebApi/"; |
| | | string url = urlHead + methodType; |
| | | |
| | | var webClient = new WebClient (); |
| | | if (urlHead == "") { |
| | | urlHead = $"{"https://homeautomation.havells.com"}/WebApi/"; |
| | | } else { |
| | | webClient.Headers.Add ("CONTENT-TYPE", "application/json"); |
| | | } |
| | | string url = urlHead + methodType; |
| | | if (needHeaders && LoginUser != null) {/* 如果不需要验证Token可以不用传入 */ |
| | | webClient.Headers.Add ("Authorization", LoginUser.LoginTokenString); |
| | | } |