| | |
| | | Y = Application.GetRealHeight (1136 - 90 - 90), |
| | | Width = Application.GetRealWidth (640), |
| | | Height = Application.GetRealHeight (90), |
| | | Text = Language.StringByID (R.MyInternationalizationString.Version) + " : " + MainPage.CodeIDString, |
| | | Text = Language.StringByID (R.MyInternationalizationString.Version) + " : " + MainPage.RequestVersion, |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | | BackgroundColor = SkinStyle.Current.ViewColor, |
| | | Enable = false |
| | |
| | | UserMiddle.updateSensorhreadList.Clear (); |
| | | } |
| | | |
| | | public static void Init (bool isGuide = false) |
| | | //2020-01-11 |
| | | public static void Init (bool isGuide = false, bool bFromLogin = false) |
| | | { |
| | | if (MainPage.LoginUser == null) |
| | | MainPage.LoginUser = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo> (System.Text.Encoding.UTF8.GetString (Shared.IO.FileUtils.ReadFile (UserInfo.GlobalRegisterFile))); |
| | |
| | | new AccountLogin ().Show (); |
| | | UserConfig.Instance.TipVersionBackup = UserConfig.Instance.VersionNumber; |
| | | } else { |
| | | if (UserConfig.Instance.GatewayList.Count == 0) { |
| | | UserHomePage.FrameLayoutMain.AddChidren (guidePageView); |
| | | var guide = new GuideAddResidence (); |
| | | guidePageView.AddChidren (guide); |
| | | guide.ShowHomeList (false); |
| | | guidePageView.PageIndex = 0; |
| | | MainPage.LoginUser.LastTime = DateTime.MinValue; |
| | | MainPage.LoginUser.SaveUserInfo (); |
| | | guidePageView.PageChange += (ddf, ffd) => { |
| | | if (ffd < guidePageView.ChildrenCount - 1) { |
| | | guidePageView.GetChildren (guidePageView.ChildrenCount - 1).RemoveFromParent (); |
| | | } |
| | | }; |
| | | return; |
| | | //if (UserConfig.Instance.GatewayList.Count == 0) { |
| | | //2020-01-11 Mac没绑定并且为主账号 是否来只登录界面 |
| | | if (bFromLogin) { |
| | | if (!UserConfig.Instance.CheckHomeGatewaysNotEmpty () && MainPage.LoginUser.AccountType == 0) { |
| | | UserHomePage.FrameLayoutMain.AddChidren (guidePageView); |
| | | var guide = new GuideAddResidence (); |
| | | guide.IsHideBack = true; |
| | | guidePageView.AddChidren (guide); |
| | | |
| | | guide.ShowHomeList (true); |
| | | guidePageView.PageIndex = 0; |
| | | MainPage.LoginUser.LastTime = DateTime.MinValue; |
| | | MainPage.LoginUser.SaveUserInfo (); |
| | | guidePageView.PageChange += (ddf, ffd) => { |
| | | if (ffd < guidePageView.ChildrenCount - 1) { |
| | | guidePageView.GetChildren (guidePageView.ChildrenCount - 1).RemoveFromParent (); |
| | | } |
| | | }; |
| | | return; |
| | | } |
| | | } |
| | | InitHomePageView (); |
| | | //后台验证账号 |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | try { |
| | | var requestObj = new LoginObj () { Account = MainPage.LoginUser.AccountString, Password = MainPage.LoginUser.Password }; |
| | | var requestObj = new LoginObj () { Account = MainPage.LoginUser.AccountString, Password = MainPage.LoginUser.Password, Company = MainPage.SoftSmsType }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj); |
| | | var revertObj = MainPage.RequestHttps ("Login", requestJson, false, false); |
| | | var revertObj = MainPage.RequestHttps (API.Login, requestJson); |
| | | if (revertObj != null) { |
| | | Application.RunOnMainThread (() => { |
| | | if (revertObj.StateCode == "SUCCESS") { |
| | | if (revertObj.StateCode.ToUpper () == "SUCCESS") { |
| | | var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes> (revertObj.ResponseData.ToString ()); |
| | | MainPage.LoginUser.AllVisionRegisterDevUserNameGuid = revertData.AllVisionRegisterDevUserNameGuid; |
| | | MainPage.LoginUser.LastTime = DateTime.Now; |
| | | MainPage.LoginUser.SaveUserInfo (); |
| | | //2020-01-14 登录成功后,刷新一次当前住宅网关 |
| | | GetNowHomeGatewayAfterLoginSuccess (); |
| | | } else if (!string.IsNullOrEmpty (revertObj.StateCode)) { |
| | | MainPage.LoginUser.LastTime = DateTime.Now.AddDays (-30); |
| | | MainPage.LoginUser.SaveUserInfo (); |
| | |
| | | if (e < SettingPageView.ChildrenCount - 1) { |
| | | SettingPageView.GetChildren (SettingPageView.ChildrenCount - 1).RemoveFromParent (); |
| | | } |
| | | if (e == 0) { |
| | | //2020-01-15 回到主界面,重置为加密 |
| | | UserConfig.Instance.IsLocalEncrypt = true; |
| | | } |
| | | }; |
| | | RoomPageView.PageChange += (sender, e) => { |
| | | if (e < RoomPageView.ChildrenCount - 1) { |
| | |
| | | UserDeviceToAC.readAllStatus (true); |
| | | UserDeviceToFH.readAllStatus (true); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 登录成功后,查询刷新一次当前住宅 网关列表 |
| | | /// 2020-01-11 |
| | | /// </summary> |
| | | static void GetNowHomeGatewayAfterLoginSuccess () |
| | | { |
| | | var requestObj3 = new GetSingleHomeGatewayPaggerObj (); |
| | | requestObj3.ReqDto.LoginAccessToken = MainPage.LoginUser.LoginTokenString; |
| | | requestObj3.ReqDto.HomeId = UserConfig.Instance.CurrentRegion.Id; |
| | | requestObj3.ReqDto.PageSetting.Page = 1; |
| | | requestObj3.ReqDto.PageSetting.PageSize = 10; |
| | | string urlHead = MainPage.RequestHttpsHost; |
| | | if (requestObj3.IsOtherAccountCtrl) { |
| | | urlHead = UserConfig.Instance.MasterAccountRequestBaseUrl; |
| | | requestObj3.ReqDto.LoginAccessToken = UserConfig.Instance.MasterAccountToken; |
| | | } |
| | | |
| | | var requestJson3 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj3); |
| | | var revertObj3 = MainPage.RequestHttps (API.GetSingleHomeGatewayPagger, requestJson3, urlHead); |
| | | if (revertObj3.StateCode.ToUpper () == "SUCCESS") { |
| | | var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<GetGatewayResult> (revertObj3.ResponseData.ToString ()); |
| | | //2020-01-11 |
| | | UserConfig.Instance.SetNowHomeGateways (infoResult.PageData); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |