| | |
| | | |
| | | public static FrameLayout UserPageView = new FrameLayout (); |
| | | |
| | | //public static Button LinkStatusTip = new Button () { |
| | | // Height = Application.GetRealHeight (36), |
| | | // Width = Application.GetRealWidth (Application.DesignWidth), |
| | | // BackgroundColor = SkinStyle.Current.LinkStatusTipColor |
| | | //}; |
| | | public static Button LinkStatusTip = new Button () { |
| | | Height = Application.GetRealHeight (Convert.ToInt32 (36 * MainPage.PixelScale)), |
| | | BackgroundColor = SkinStyle.Current.MainColor |
| | | }; |
| | | |
| | | public static PageLayout FavoritePageView = new PageLayout () { |
| | | IsShowPoint = false, |
| | |
| | | |
| | | public static FrameLayout UserMenuItem = new FrameLayout () { |
| | | Y = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight), |
| | | Height = Application.GetRealHeight (userMenuItemHeight+5), |
| | | Height = Application.GetMinRealAverage (userMenuItemHeight+5), |
| | | BackgroundColor = SkinStyle.Current.MainColor |
| | | }; |
| | | |
| | |
| | | |
| | | public static Button btnLinkStatus = new Button () { |
| | | Y = Application.GetRealHeight (10), |
| | | Width = Application.GetRealWidth (131), |
| | | Height = Application.GetRealHeight (80), |
| | | Width = Application.GetMinRealAverage (131), |
| | | Height = Application.GetMinRealAverage (80), |
| | | UnSelectedImagePath = MainPage.WiFiStatus, |
| | | }; |
| | | |
| | | #region ---Bottom Button---- |
| | | public static Button btnFavorite = new Button () { |
| | | Width = Application.GetRealWidth (160), |
| | | Height = MainPage.GetDesignHeight (90), |
| | | TextID = R.MyInternationalizationString.Favorite, |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | | SelectedTextColor = SkinStyle.Current.SelectedColor, |
| | |
| | | public static Button btnDevice = new Button () { |
| | | X = Application.GetRealWidth (160), |
| | | Width = Application.GetRealWidth (160), |
| | | Height = MainPage.GetDesignHeight (90), |
| | | TextID = R.MyInternationalizationString.Category, |
| | | SelectedTextColor = SkinStyle.Current.SelectedColor, |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | |
| | | public static Button btnRoom = new Button () { |
| | | X = Application.GetRealWidth (160 * 2), |
| | | Width = Application.GetRealWidth (160), |
| | | Height = MainPage.GetDesignHeight (90), |
| | | TextID = R.MyInternationalizationString.Rooms, |
| | | SelectedTextColor = SkinStyle.Current.SelectedColor, |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | |
| | | public static Button btnSetting = new Button () { |
| | | X = Application.GetRealWidth (160 * 3), |
| | | Width = Application.GetRealWidth (160), |
| | | Height = MainPage.GetDesignHeight (90), |
| | | TextID = R.MyInternationalizationString.Setting, |
| | | SelectedTextColor = SkinStyle.Current.SelectedColor, |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | |
| | | //后台验证账号 |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | try { |
| | | 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 (API.Login, requestJson); |
| | | var revertObj = HttpServerRequest.Current.LoginByPassword (MainPage.LoginUser.AccountString, MainPage.LoginUser.Password); |
| | | if (revertObj != null) { |
| | | Application.RunOnMainThread (() => { |
| | | 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)) { |
| | | if (revertObj.StateCode != ErrorCode.NetworkError && revertObj.StateCode != "Data Exception") { |
| | | MainPage.LoginUser.LastTime = DateTime.Now.AddDays (-30); |
| | | MainPage.LoginUser.SaveUserInfo (); |
| | | new AccountLogin ().Show (); |
| | | } |
| | | //Application.RunOnMainThread (() => { |
| | | if (revertObj.Code == StateCode.SUCCESS) { |
| | | var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes> (revertObj.Data.ToString ()); |
| | | //MainPage.LoginUser.AllVisionRegisterDevUserNameGuid = revertData.AllVisionRegisterDevUserNameGuid; |
| | | MainPage.LoginUser.LoginTokenString = revertData.headerPrefix + revertData.accessToken; |
| | | MainPage.LoginUser.RefreshToken = revertData.refreshToken; |
| | | MainPage.LoginUser.LastTime = DateTime.Now; |
| | | MainPage.LoginUser.SaveUserInfo (); |
| | | //2020-01-14 验证账号通过后 |
| | | if (!bFromLogin) { |
| | | HttpServerRequest.Current.GetHomeGatewayList (); |
| | | } |
| | | }); |
| | | } else if (!string.IsNullOrEmpty (revertObj.Code)) { |
| | | if (revertObj.Code != StateCode.NETWORK_ERROR && revertObj.Code != StateCode.DATA_EXCEPTION) { |
| | | MainPage.LoginUser.LastTime = DateTime.Now.AddDays (-30); |
| | | MainPage.LoginUser.SaveUserInfo (); |
| | | //提示错误原因 |
| | | IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code); |
| | | Application.RunOnMainThread (() => { |
| | | new AccountLogin ().Show (); |
| | | }); |
| | | |
| | | } |
| | | } |
| | | //}); |
| | | } |
| | | } catch { } finally { |
| | | UserConfig.Instance.SaveUserConfig (); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | //IO.FileUtils.SaveEquipmentMessage (ud3, "3"); |
| | | #endif |
| | | UserHomePage.FrameLayoutMain.AddChidren (UserPageView); |
| | | //UserHomePage.FrameLayoutMain.AddChidren (LinkStatusTip); |
| | | UserHomePage.FrameLayoutMain.AddChidren (LinkStatusTip); |
| | | |
| | | UserPageView.AddChidren (FavoritePageView); |
| | | FavoritePageView.AddChidren (FavoriteBodyView); |
| | |
| | | |
| | | |
| | | |
| | | /// <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; |
| | | } |
| | | ///// <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); |
| | | // var requestJson3 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj3); |
| | | // var revertObj3 = MainPage.RequestHttps (API.GetSingleHomeGatewayPagger, requestJson3, urlHead); |
| | | // if (revertObj3.StateCode.ToUpper () == StateCode.SUCCESS) { |
| | | // var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<GetGatewayResult> (revertObj3.ResponseData.ToString ()); |
| | | // //2020-01-11 |
| | | // UserConfig.Instance.SetNowHomeGateways (infoResult.PageData); |
| | | |
| | | } |
| | | } |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | } |