wxr
2019-12-26 dae426f9d22dabacaa78201414d86e1014992227
Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
@@ -173,28 +173,31 @@
                        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
                urlHead = $"{"https://homeautomation.havells.com"}/WebApi/";
                urlHead = "https://developer.hdlcontrol.com/api/";
                string url = urlHead + methodType;
                var webClient = new WebClient ();
                if (urlHead == "") {
                    urlHead = $"{"https://homeautomation.havells.com"}/WebApi/";
                    urlHead = "https://developer.hdlcontrol.com/api/";
                } else {
                    webClient.Headers.Add ("CONTENT-TYPE", "application/json");
                }
                string url = urlHead + methodType;
                if (needHeaders && LoginUser != null) {/* 如果不需要验证Token可以不用传入 */
                    webClient.Headers.Add ("Authorization", LoginUser.LoginTokenString);
                }