using System; using System.Collections.Generic; using Shared.SimpleControl.Phone.Music; namespace Shared.SimpleControl.Phone { public static class UserMiddle { //public static Button AppBtnTip = new Button () { // Height = Application.GetRealHeight (140), // BackgroundColor = 0xFFD7D7D7, //}; public static int userMenuItemHeight { get { //if (Application.PixelScale > 1) { // return Convert.ToInt32 (90 * Application.PixelScale + 20); //} else { return Convert.ToInt32 (90 * MainPage.PixelScale); //} } } public static FrameLayout UserPageView = new FrameLayout (); 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 FavoriteBodyView = new FrameLayout () { //Width = Application.GetRealWidth (Application.DesignWidth), //Height = Application.GetRealHeight (Application.DesignHeight) }; public static UserRoom FavoriteRoom = new UserRoom () { //Width = Application.GetRealWidth (Application.DesignWidth), Height = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight) }; public static PageLayout DevicePageView = new PageLayout () { IsShowPoint = false, }; public static FrameLayout DeviceBodyView = new FrameLayout () { //Width = Application.GetRealWidth (Application.DesignWidth), Height = Application.GetRealHeight (Application.DesignHeight) }; public static VerticalScrolViewLayout DeviceView = new VerticalScrolViewLayout () { Y = Application.GetRealHeight (126), //Width = Application.GetRealWidth (Application.DesignWidth), Height = Application.GetRealHeight (Application.DesignHeight - 126 - userMenuItemHeight), }; public static PageLayout RoomPageView = new PageLayout () { IsShowPoint = false, }; public static FrameLayout RoomBodyView = new FrameLayout () { Width = Application.GetRealWidth (Application.DesignWidth), Height = Application.GetRealHeight (Application.DesignHeight) }; public static PageLayout SettingPageView = new PageLayout () { IsShowPoint = false, }; public static FrameLayout SettingBodyView = new FrameLayout () { BackgroundColor = SkinStyle.Current.MainColor, Height = Application.GetRealHeight (Application.DesignHeight) }; public static VerticalScrolViewLayout SettingView = new VerticalScrolViewLayout () { Y = Application.GetRealHeight (126), Width = Application.GetRealWidth (Application.DesignWidth), Height = Application.GetRealHeight (Application.DesignHeight - 126 - userMenuItemHeight - 90), BackgroundColor = SkinStyle.Current.ViewColor, //ScrollEnabled = true }; public static Button btnVersion = new Button () { Y = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight - 90), Width = Application.GetRealWidth (Application.DesignWidth), Height = Application.GetRealHeight (90), Text = Language.StringByID (R.MyInternationalizationString.Version) + " : " + MainPage.RequestVersion, TextColor = SkinStyle.Current.TextColor1, BackgroundColor = SkinStyle.Current.ViewColor, Enable = false }; public static FrameLayout UserMenuItem = new FrameLayout () { Y = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight), Height = Application.GetMinRealAverage (userMenuItemHeight+5), BackgroundColor = SkinStyle.Current.MainColor }; public static PageLayout guidePageView = new PageLayout () { IsShowPoint = false }; static int curPageView = 0; public static List updateSensorhreadList = new List (); public static Button btnLinkStatus = new Button () { Y = Application.GetRealHeight (10), 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, BackgroundColor = SkinStyle.Current.MainColor, SelectedBackgroundColor = SkinStyle.Current.UserMenuItemButton, UnSelectedImagePath = "Navigation/MenuFavorite.png", SelectedImagePath = "Navigation/MenuFavoriteOn.png", TextSize = 10, Padding = new Padding (Application.GetRealHeight (50), 0, 0, 0), IsSelected = true }; 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, BackgroundColor = SkinStyle.Current.MainColor, SelectedBackgroundColor = SkinStyle.Current.UserMenuItemButton, UnSelectedImagePath = "Navigation/MenuCategory.png", SelectedImagePath = "Navigation/MenuCategoryOn.png", TextSize = 10, Padding = new Padding (Application.GetRealHeight (50), 0, 0, 0), }; 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, BackgroundColor = SkinStyle.Current.MainColor, SelectedBackgroundColor = SkinStyle.Current.UserMenuItemButton, UnSelectedImagePath = "Navigation/MenuRoom.png", SelectedImagePath = "Navigation/MenuRoomOn.png", TextSize = 10, Padding = new Padding (Application.GetRealHeight (50), 0, 0, 0), }; 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, BackgroundColor = SkinStyle.Current.MainColor, SelectedBackgroundColor = SkinStyle.Current.UserMenuItemButton, UnSelectedImagePath = "Navigation/MenuSettings.png", SelectedImagePath = "Navigation/MenuSettingsOn.png", TextSize = 10, Padding = new Padding (Application.GetRealHeight (50), 0, 0, 0), }; public static void SelectedBottomButton (Button btn) { if (btnFavorite.Parent == null) UserMenuItem.AddChidren (btnFavorite); if (btnDevice.Parent == null) UserMenuItem.AddChidren (btnDevice); if (btnRoom.Parent == null) UserMenuItem.AddChidren (btnRoom); if (btnSetting.Parent == null) UserMenuItem.AddChidren (btnSetting); btnFavorite.IsSelected = false; btnDevice.IsSelected = false; btnRoom.IsSelected = false; btnSetting.IsSelected = false; btn.IsSelected = true; } #endregion //public static void CleanPageView () //{ // FavoriteRoom.RemoveAll (); // FavoriteBodyView.RemoveAll (); // FavoritePageView.RemoveAll (); // DeviceView.RemoveAll (); // DeviceBodyView.RemoveAll (); // DevicePageView.RemoveAll (); // RoomBodyView.RemoveAll (); // RoomPageView.RemoveAll (); // SettingView.RemoveAll (); // SettingBodyView.RemoveAll (); // SettingPageView.RemoveAll (); // UserPageView.RemoveAll (); //} static void CleanPageView (FrameLayout BodyView) { FavoriteRoom.RemoveAll (); FavoriteBodyView.RemoveAll (); FavoritePageView.RemoveAll (); DeviceView.RemoveAll (); DeviceBodyView.RemoveAll (); DevicePageView.RemoveAll (); RoomBodyView.RemoveAll (); RoomPageView.RemoveAll (); SettingView.RemoveAll (); SettingBodyView.RemoveAll (); SettingPageView.RemoveAll (); UserPageView.RemoveAll (); BodyView.AddChidren (UserMenuItem); foreach (var thread in UserMiddle.updateSensorhreadList) { thread.Abort (); Utlis.WriteLine ("abortThread"); } UserMiddle.updateSensorhreadList.Clear (); } /// /// 移除GuidePageView /// static void removeGuidePageView () { if (guidePageView != null) { if (guidePageView.Parent != null) { Utlis.WriteLine ("移除GuidePageView Parent 不为"); } guidePageView.RemoveFromParent (); } } /// /// 是否刷新过住宅信息 2022-06-22 14:16:27 /// static bool refreshHomeData = false; /// /// 2020-01-11 /// /// 是否Guide /// 是否来自登录界面 public static void Init (bool isGuide = false, bool bFromLogin = false) { if (MainPage.LoginUser == null) MainPage.LoginUser = Newtonsoft.Json.JsonConvert.DeserializeObject (System.Text.Encoding.UTF8.GetString (Shared.IO.FileUtils.ReadFile (UserInfo.GlobalRegisterFile))); //判断需不需要登陆,有没有登陆,或者登陆是否过期, if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) { new AccountLogin ().Show (); UserConfig.Instance.TipVersionBackup = UserConfig.Instance.VersionNumber; } else { //2021-03-23 移除GuidePageView removeGuidePageView (); //if (UserConfig.Instance.GatewayList.Count == 0) { //2020-01-11 Mac没绑定 是否来只登录界面 if (bFromLogin) { if (!UserConfig.Instance.CheckHomeGatewaysNotEmpty ()) { #region 多次迁移住宅导致网关被移除的情况 if (!refreshHomeData) { refreshHomeData = true; //获取住宅列表 var revertObjCode = HttpServerRequest.Current.GetHomePager (); if (revertObjCode == StateCode.SUCCESS) { var mHomeLists = UserConfig.Instance.HomeLists; if (mHomeLists != null && mHomeLists.Count > 0) { var bFind = false; foreach (var mHome in mHomeLists) { if (mHome.isBindGateway) { bFind = true; UserConfig.Instance.CurrentRegion = mHome; break; } } if (!bFind) { var findRoom2 = mHomeLists.Find ((obj) => obj.IsOthreShare == false); if (findRoom2 != null) { UserConfig.Instance.CurrentRegion = findRoom2; } else { UserConfig.Instance.CurrentRegion = mHomeLists [0]; } } IO.FileUtils.DeleteAllFile (); } SaveUserConfig (mHomeLists); } return; } #endregion UserHomePage.FrameLayoutMain.AddChidren (guidePageView); var guide = new GuideAddResidence (); guide.IsHideBack = true; guidePageView.AddChidren (guide); guide.ShowHomeView (true); guidePageView.PageIndex = 0; MainPage.LoginUser.LastTime = DateTime.MinValue; MainPage.LoginUser.SaveUserInfo (); guidePageView.PageChange += (sender, e) => { if (e < guidePageView.ChildrenCount - 1) { guidePageView.GetChildren (guidePageView.ChildrenCount - 1).RemoveFromParent (); } }; return; } } InitHomePageView (); //后台验证账号 System.Threading.Tasks.Task.Run (() => { try { var revertObj = HttpServerRequest.Current.LoginByPassword (MainPage.LoginUser.AccountString, MainPage.LoginUser.Password); if (revertObj != null) { //Application.RunOnMainThread (() => { if (revertObj.Code == StateCode.SUCCESS) { var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject (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 (); } }); if (isGuide) { ShowRoomsView (); } } UserConfig.Instance.SaveUserConfig (); EventHandler btnLinkEvent = (sender, e) => { try { if (SmartHome.MqttCommon.remoteMqttIsConnecting && CommonPage.IsRemote) { Alert alert = new Alert ("", "Being connected remotely, do you still want to cancel and re-detect?", Language.StringByID (R.MyInternationalizationString.Cancel), Language.StringByID (R.MyInternationalizationString.Confrim)); alert.ResultEventHandler += (sender2, e2) => { if (e2) { EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus); } }; alert.Show (); //MainPage.ShowAlertOnMainThread ("Please wait, connecting remotely..."); } else { EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus); } } catch { } }; try { //2020-04-23 解决安卓重复弹窗问题 if (btnLinkStatus.MouseUpEventHandler == null) { btnLinkStatus.MouseUpEventHandler += btnLinkEvent; } else { btnLinkStatus.MouseUpEventHandler -= btnLinkEvent; btnLinkStatus.MouseUpEventHandler += btnLinkEvent; } } catch { //Utlis.WriteLine ("ccc"); } } /// /// 加载用户界面 /// static void InitHomePageView () { //SystemRemote.LinkRemote ("", "", "",true); if (null != UserPageView.Parent) { CleanPageView (FavoriteBodyView); UserPageView.AddChidren (FavoritePageView); FavoritePageView.AddChidren (FavoriteBodyView); FavoriteBodyView.AddChidren (FavoriteRoom); FavoriteRoom.InitRoomView (Room.FavoriteRoom); SelectedBottomButton (btnFavorite); curPageView = 0; return; } Language.CurrentLanguage = "English"; #if DEBUG //UserConfig.Instance.SkinCode = 1; Language.CurrentLanguage = "English"; //var lii = new LightLogic () { Type = DeviceType.LightRGB, LoopID = 1, DeviceID = 4, SubnetID = 42, Name = "RGB" }; //IO.FileUtils.SaveEquipmentMessage (lii, lii.LoopID.ToString ()); //var lii1 = new LightSwitch () { LoopID = 1, DeviceID = 2, SubnetID = 232, Name = "继电器" }; //IO.FileUtils.SaveEquipmentMessage (lii1, lii1.LoopID.ToString ()); ////var lii11 = new LightDimming () { LoopID = 1, DeviceID = 1, SubnetID = 232, Name = "调光器" }; ////IO.FileUtils.SaveEquipmentMessage (lii11, lii11.LoopID.ToString ()); ////var lii111 = new LightDimming () { LoopID = 1, DeviceID = 8, SubnetID = 232, Name = "调光器2" }; ////IO.FileUtils.SaveEquipmentMessage (lii111, lii111.LoopID.ToString ()); //var mCurtainModel1 = new CurtainModel () { LoopID = 1, DeviceID = 9, SubnetID = 42, Name = "窗帘" }; //IO.FileUtils.SaveEquipmentMessage (mCurtainModel1, mCurtainModel1.LoopID.ToString ()); ////var mCurtainModel2 = new CurtainModel () { LoopID = 2, DeviceID = 9, SubnetID = 42, Name = "窗帘2" }; ////IO.FileUtils.SaveEquipmentMessage (mCurtainModel2, mCurtainModel2.LoopID.ToString ()); //var mCurtainModel3 = new CurtainModel () { LoopID = 1, DeviceID = 2, SubnetID = 42, Name = "窗帘3" }; //IO.FileUtils.SaveEquipmentMessage (mCurtainModel3, mCurtainModel3.LoopID.ToString ()); //var mCurtainRoller = new CurtainRoller () { LoopID = 1, DeviceID = 88, SubnetID = 42, Name = "窗帘CurtainRoller" }; //IO.FileUtils.SaveEquipmentMessage (mCurtainRoller, mCurtainRoller.LoopID.ToString ()); //var mCurtainTrietex = new CurtainTrietex () { LoopID = 1, DeviceID = 87, SubnetID = 42, Name = "窗帘CurtainTrietex" }; //IO.FileUtils.SaveEquipmentMessage (mCurtainTrietex, mCurtainTrietex.LoopID.ToString ()); //var s1 = new LightEnergySocket () { LoopID = 1, DeviceID = 1, SubnetID = 44, Name = "EnergySocket" }; //IO.FileUtils.SaveEquipmentMessage (s1, s1.LoopID.ToString ()); //var s2 = new LightEnergySwitch () { LoopID = 11, DeviceID = 1, SubnetID = 44, Name = "EnergySwitch" }; //IO.FileUtils.SaveEquipmentMessage (s2, s2.LoopID.ToString ()); //InfraredMode infraredMode = new InfraredMode () { LoopID = 1, SubnetID = 100, DeviceID = 12, InfraredType = InfraredType.TV, Name = "测试电视" }; //IO.FileUtils.SaveEquipmentMessage (infraredMode, "1"); //ACInfrared aCInfrared = new ACInfrared () { LoopID = 1, SubnetID = 100, DeviceID = 112, Name = "空调ACInfrared" }; //IO.FileUtils.SaveEquipmentMessage (aCInfrared, "1"); //ACPanel mACPanel = new ACPanel () { LoopID = 1, SubnetID = 100, DeviceID = 42, Name = "空调面板ACPanel" }; //IO.FileUtils.SaveEquipmentMessage (mACPanel, "1"); //CustomAC mCustomAC = new CustomAC () { LoopID = 1, SubnetID = 99, DeviceID = 42, Name = "空调CustomAC" }; //IO.FileUtils.SaveEquipmentMessage (mCustomAC, "1"); //HVAC mHVAC = new HVAC () { LoopID = 1, SubnetID = 98, DeviceID = 42, Name = "空调HVAC" }; //IO.FileUtils.SaveEquipmentMessage (mHVAC, "1"); //var fanM = new FanModule () { Name = "Fan Module",SubnetID = 2,DeviceID = 1,LoopID = 1}; //IO.FileUtils.SaveEquipmentMessage (fanM); //var fanLoop1 = new FanModule () { Name = "Fan 1", SubnetID = 2, DeviceID = 1, LoopID = 1 }; //IO.FileUtils.SaveEquipmentMessage (fanLoop1, "1"); //var fanLoop2 = new FanModule () { Name = "Fan 2", SubnetID = 2, DeviceID = 1, LoopID = 2 }; //IO.FileUtils.SaveEquipmentMessage (fanLoop2, "2"); //LightEnergySocket sddd = new LightEnergySocket () { LoopID = 1, SubnetID = 100, DeviceID = 122, Name = "测试插座" }; //IO.FileUtils.SaveEquipmentMessage (sddd, "1"); //var ud = new UniversalDevice () { LoopID = 1, SubnetID = 1, DeviceID = 100, ActionType = 2, Name = "通用开关", obj1 = 1, TargetType = 0 }; //ud.SendBytes = new List () { 1, 0 }; //IO.FileUtils.SaveEquipmentMessage (ud, ud.LoopID.ToString()); //var ud2 = new UniversalDevice () { LoopID = 2, SubnetID = 1, DeviceID = 100, ActionType = 2, Name = "通用开关2", obj1 = 1, TargetType = 0 }; //ud.SendBytes = new List () { 1, 255 }; //IO.FileUtils.SaveEquipmentMessage (ud, ud.LoopID.ToString ()); //var ud2 = new UniversalDevice () { LoopID = 2, SubnetID = 42, DeviceID = 6, ActionType = 0, Name = "Universal-2", obj1 = 1,TargetType = 1}; //ud2.SendBytes = new List () { 2 ,0}; //IO.FileUtils.SaveEquipmentMessage (ud2, "2"); //var ud3 = new UniversalDevice () { LoopID = 3, SubnetID = 42, DeviceID = 6, ActionType = 1, Name = "Universal-3", obj1 = 1 ,TargetType = 2}; //ud3.SendBytes = new List () { 3 ,0}; //IO.FileUtils.SaveEquipmentMessage (ud3, "3"); #endif UserHomePage.FrameLayoutMain.AddChidren (UserPageView); UserHomePage.FrameLayoutMain.AddChidren (LinkStatusTip); UserPageView.AddChidren (FavoritePageView); FavoritePageView.AddChidren (FavoriteBodyView); FavoriteBodyView.AddChidren (UserMenuItem); FavoriteBodyView.AddChidren (FavoriteRoom); FavoriteRoom.InitRoomView (Room.FavoriteRoom); #region 底部导航栏 UserMenuItem.AddChidren (btnFavorite); UserMenuItem.AddChidren (btnDevice); UserMenuItem.AddChidren (btnRoom); UserMenuItem.AddChidren (btnSetting); SelectedBottomButton (btnFavorite); btnFavorite.MouseUpEventHandler += (sender, e) => { CleanPageView (FavoriteBodyView); UserPageView.AddChidren (FavoritePageView); FavoritePageView.AddChidren (FavoriteBodyView); FavoriteBodyView.AddChidren (FavoriteRoom); FavoriteRoom.InitRoomView (Room.FavoriteRoom); SelectedBottomButton (btnFavorite); curPageView = 0; SharedMethod.SharedMethod.CurPageLayout = FavoritePageView; }; btnDevice.MouseUpEventHandler += (sender, e) => { try { CleanPageView (DeviceBodyView); UserPageView.AddChidren (DevicePageView); DevicePageView.AddChidren (DeviceBodyView); DeviceBodyView.AddChidren (DeviceView); SelectedBottomButton (sender as Button); UserDeviceView.DeviceMode (); SharedMethod.SharedMethod.CurPageLayout = DevicePageView; curPageView = 1; } catch { } finally { } }; btnRoom.MouseUpEventHandler += (sender, e) => { CleanPageView (RoomBodyView); UserPageView.AddChidren (RoomPageView); RoomPageView.AddChidren (RoomBodyView); UserRooms.ShowRoomList (); SelectedBottomButton (btnRoom); curPageView = 2; SharedMethod.SharedMethod.CurPageLayout = RoomPageView; }; btnSetting.MouseUpEventHandler += (sender, e) => { CleanPageView (SettingBodyView); UserPageView.AddChidren (SettingPageView); SettingPageView.AddChidren (SettingBodyView); SettingBodyView.AddChidren (SettingView); SettingBodyView.AddChidren (btnVersion); SelectedBottomButton (btnSetting); UserSettingView.InitUserSettingView (); SettingPageView.PageIndex = 0; curPageView = 3; SharedMethod.SharedMethod.CurPageLayout = SettingPageView; }; FavoritePageView.PageChange += (sender, e) => { if (e < FavoritePageView.ChildrenCount - 1) { FavoritePageView.GetChildren (FavoritePageView.ChildrenCount - 1).RemoveFromParent (); } }; SettingPageView.PageChange += (sender, e) => { 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) { RoomPageView.GetChildren (RoomPageView.ChildrenCount - 1).RemoveFromParent (); } }; DevicePageView.PageChange += (sender, e) => { while (e < DevicePageView.ChildrenCount - 1) { DevicePageView.GetChildren (DevicePageView.ChildrenCount - 1).RemoveFromParent (); } if (e == 0) { DevicePageView.ScrollEnabled = true; } }; #endregion } public static void ShowSettingView () { CleanPageView (SettingBodyView); UserPageView.AddChidren (SettingPageView); SettingPageView.AddChidren (SettingBodyView); SettingBodyView.AddChidren (SettingView); SettingBodyView.AddChidren (btnVersion); SelectedBottomButton (btnSetting); UserSettingView.InitUserSettingView (); } public static void ShowRoomsView () { CleanPageView (RoomBodyView); UserPageView.AddChidren (RoomPageView); RoomPageView.AddChidren (RoomBodyView); //UserMiddle.RoomBodyView.RemoveAll (); UserRooms.ShowRoomList (); SelectedBottomButton (btnRoom); curPageView = 2; } public static void ReadAllDeviceStatus (bool isRefresh = true, bool isCheckIsReadingAll = false) { if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) { return; } UserDeviceToLight.readAllStatus (isRefresh, isCheckIsReadingAll); UserDeviceToSocket.readAllStatus (isRefresh, isCheckIsReadingAll); UserDeviceToAC.readAllStatus (isRefresh, isCheckIsReadingAll); UserDeviceToFH.readAllStatus (isRefresh); } ///// ///// 登录成功后,查询刷新一次当前住宅 网关列表 ///// 2020-01-11 ///// //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 () == StateCode.SUCCESS) { // var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject (revertObj3.ResponseData.ToString ()); // //2020-01-11 // UserConfig.Instance.SetNowHomeGateways (infoResult.PageData); // } //} /// /// 保存数据 并加载页面 /// /// static void SaveUserConfig (List revertRoomData) { UserConfig.Instance.SaveUserConfig (); MainPage.LoginUser.LastTime = DateTime.Now; if (UserConfig.Instance.CheckHomeGatewaysNotEmpty ()) { MainPage.LoginUser.SaveUserInfo (); Scene.Refresh (); A31MusicModel.Refresh (); Application.RunOnMainThread (() => { Init (false, true); EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus); }); } else { Application.RunOnMainThread (() => { Init (false, true); }); } } } }