From f500e14c0a994487070380c50c85e0929cbc8e63 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 05 一月 2021 10:48:04 +0800
Subject: [PATCH] 2021-01-05 1.更新

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs |  269 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 199 insertions(+), 70 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
index 9053a8f..2c93b08 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs
@@ -6,6 +6,11 @@
 {
     public static class UserMiddle
     {
+        //public static Button AppBtnTip = new Button () {
+        //    Height = Application.GetRealHeight (140),
+        //    BackgroundColor = 0xFFD7D7D7,
+        //};
+
 
         public static int userMenuItemHeight {
             get {
@@ -19,43 +24,42 @@
 
         public static FrameLayout UserPageView = new FrameLayout ();
 
-        //public static Button LinkStatusTip = new Button () {
-        //    Height = Application.GetRealHeight (36),
-        //    Width = Application.GetRealWidth (640),
-        //    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 FavoriteBodyView = new FrameLayout () {
-            Width = Application.GetRealWidth (640),
-            Height = Application.GetRealHeight (1136)
+            //Width = Application.GetRealWidth (Application.DesignWidth),
+            //Height = Application.GetRealHeight (Application.DesignHeight)
         };
         public static UserRoom FavoriteRoom = new UserRoom () {
-            Width = Application.GetRealWidth (640),
-            Height = Application.GetRealHeight (1136 - 90)
+            //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 (640),
-            Height = Application.GetRealHeight (1136)
+            //Width = Application.GetRealWidth (Application.DesignWidth),
+            Height = Application.GetRealHeight (Application.DesignHeight)
         };
         public static VerticalScrolViewLayout DeviceView = new VerticalScrolViewLayout () {
             Y = Application.GetRealHeight (126),
-            Width = Application.GetRealWidth (640),
-            Height = Application.GetRealHeight (1136 - 126 - 90),
+            //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 (640),
-            Height = Application.GetRealHeight (1136)
+            Width = Application.GetRealWidth (Application.DesignWidth),
+            Height = Application.GetRealHeight (Application.DesignHeight)
         };
 
         public static PageLayout SettingPageView = new PageLayout () {
@@ -63,28 +67,28 @@
         };
         public static FrameLayout SettingBodyView = new FrameLayout () {
             BackgroundColor = SkinStyle.Current.MainColor,
-            Height = Application.GetRealHeight (1136)
+            Height = Application.GetRealHeight (Application.DesignHeight)
         };
         public static VerticalScrolViewLayout SettingView = new VerticalScrolViewLayout () {
             Y = Application.GetRealHeight (126),
-            Width = Application.GetRealWidth (640),
-            Height = Application.GetRealHeight (1136 - 126 - 90 - 90),
+            Width = Application.GetRealWidth (Application.DesignWidth),
+            Height = Application.GetRealHeight (Application.DesignHeight - 126 - userMenuItemHeight - 90),
             BackgroundColor = SkinStyle.Current.ViewColor,
-            ScrollEnabled = false
+            //ScrollEnabled = true
         };
         public static Button btnVersion = new Button () {
-            Y = Application.GetRealHeight (1136 - 90 - 90),
-            Width = Application.GetRealWidth (640),
+            Y = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight - 90),
+            Width = Application.GetRealWidth (Application.DesignWidth),
             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
         };
 
         public static FrameLayout UserMenuItem = new FrameLayout () {
-            Y = Application.GetRealHeight (Application.DesignHeight - 90),
-            Height = Application.GetRealHeight (95),
+            Y = Application.GetRealHeight (Application.DesignHeight - userMenuItemHeight),
+            Height = Application.GetMinRealAverage (userMenuItemHeight+5),
             BackgroundColor = SkinStyle.Current.MainColor
         };
 
@@ -97,14 +101,15 @@
 
         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,
@@ -120,6 +125,7 @@
         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,
@@ -133,6 +139,7 @@
         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,
@@ -146,6 +153,7 @@
         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,
@@ -175,6 +183,21 @@
         }
         #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 ();
@@ -192,12 +215,13 @@
             BodyView.AddChidren (UserMenuItem);
             foreach (var thread in UserMiddle.updateSensorhreadList) {
                 thread.Abort ();
-                Console.WriteLine ("abortThread");
+                Utlis.WriteLine ("abortThread");
             }
             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)));
@@ -206,39 +230,53 @@
                 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 ();
+                //if (UserConfig.Instance.GatewayList.Count == 0) {
+                //2020-01-11 Mac娌$粦瀹� 鏄惁鏉ュ彧鐧诲綍鐣岄潰
+                if (bFromLogin) {
+                    if (!UserConfig.Instance.CheckHomeGatewaysNotEmpty ()) {
+                        if (guidePageView != null) {
+                            guidePageView.RemoveAll ();
+                            guidePageView.RemoveFromParent ();
                         }
-                    };
-                    return;
+                        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 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 ();
-                                    new AccountLogin ().Show ();
+                                    if (revertObj.StateCode != ErrorCode.NetworkError && revertObj.StateCode != "Data Exception") {
+                                        MainPage.LoginUser.LastTime = DateTime.Now.AddDays (-30);
+                                        MainPage.LoginUser.SaveUserInfo ();
+                                        new AccountLogin ().Show ();
+                                    }
                                 }
                             });
                         }
@@ -251,9 +289,38 @@
                 }
             }
             UserConfig.Instance.SaveUserConfig ();
-            btnLinkStatus.MouseUpEventHandler += (dd, ff) => {
-                EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus);
+
+           
+            EventHandler<MouseEventArgs> 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 瑙e喅瀹夊崜閲嶅寮圭獥闂
+                if (btnLinkStatus.MouseUpEventHandler == null) {
+                    btnLinkStatus.MouseUpEventHandler += btnLinkEvent;
+                } else {
+                    btnLinkStatus.MouseUpEventHandler -= btnLinkEvent;
+                    btnLinkStatus.MouseUpEventHandler += btnLinkEvent;
+                }
+              
+            } catch {
+                //Utlis.WriteLine ("ccc");
+            }
+
         }
 
 
@@ -265,6 +332,7 @@
             //SystemRemote.LinkRemote ("", "", "",true); 
             if (null != UserPageView.Parent) {
                 if (guidePageView.Parent != null) {
+                    guidePageView.RemoveAll ();
                     guidePageView.RemoveFromParent ();
                 }
                 CleanPageView (FavoriteBodyView);
@@ -277,21 +345,36 @@
 
                 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 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 licci11 = new CurtainModel () { LoopID = 1, DeviceID = 9, SubnetID = 42, Name = "绐楀笜" };
-            //IO.FileUtils.SaveEquipmentMessage (licci11, licci11.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 ());
@@ -299,18 +382,30 @@
             //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 = "娴嬭瘯绌鸿皟" };
-            IO.FileUtils.SaveEquipmentMessage (aCInfrared, "1");
+            //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");
+            //LightEnergySocket sddd = new LightEnergySocket () { LoopID = 1, SubnetID = 100, DeviceID = 122,   Name = "娴嬭瘯鎻掑骇" };
+            //IO.FileUtils.SaveEquipmentMessage (sddd, "1");
 
             //var ud = new UniversalDevice () { LoopID = 1,SubnetID = 42,DeviceID = 6,ActionType = 2,Name = "Universal-1",obj1 = 1,TargetType = 0};
             //ud.SendBytes = new List<byte> () { 1 ,0};
@@ -323,7 +418,7 @@
             //IO.FileUtils.SaveEquipmentMessage (ud3, "3");
 #endif
             UserHomePage.FrameLayoutMain.AddChidren (UserPageView);
-            //UserHomePage.FrameLayoutMain.AddChidren (LinkStatusTip);
+            UserHomePage.FrameLayoutMain.AddChidren (LinkStatusTip);
 
             UserPageView.AddChidren (FavoritePageView);
             FavoritePageView.AddChidren (FavoriteBodyView);
@@ -393,6 +488,10 @@
                 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) {
@@ -434,15 +533,45 @@
             curPageView = 2;
         }
 
-        public static void ReadAllDeviceStatus ()
+        public static void ReadAllDeviceStatus (bool isRefresh = true, bool isCheckIsReadingAll = false)
         {
             if (MainPage.LoginUser == null || !MainPage.LoginUser.IsLogin) {
                 return;
             }
-            UserDeviceToLight.readAllStatus (true);
-            UserDeviceToSocket.readAllStatus (true);
-            UserDeviceToAC.readAllStatus (true);
-            UserDeviceToFH.readAllStatus (true);
+            UserDeviceToLight.readAllStatus (isRefresh, isCheckIsReadingAll);
+            UserDeviceToSocket.readAllStatus (isRefresh, isCheckIsReadingAll);
+            UserDeviceToAC.readAllStatus (isRefresh, isCheckIsReadingAll);
+            UserDeviceToFH.readAllStatus (isRefresh);
         }
+
+     
+
+        /// <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);
+
+            }
+        }
+
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0