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/Guide/GuideAddResidence.cs |  429 ++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 289 insertions(+), 140 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs
index 1cbb57a..a7c8412 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs
@@ -7,14 +7,91 @@
     {
         public bool IsHideBack = false;
 
+        bool IsNeedGoToGuideAddGatewayView = false;
 
         public GuideAddResidence ()
         {
             BackgroundColor = SkinStyle.Current.MainColor;
         }
 
-        public void ShowHomeList (bool showDialog = false)
+        //bool isInitViewEnd = false;
+        VerticalScrolViewLayout VerticalScrolViewMiddle;
+
+        public void ShowHomeView (bool showDialog = false) {
+            #region 鏍囬
+            var topView = new FrameLayout () {
+                Y = Application.GetRealHeight (36),
+                Height = Application.GetRealHeight (90),
+            };
+            AddChidren (topView);
+
+            var title = new Button () {
+                TextAlignment = TextAlignment.Center,
+                Text = "Zones/Residences",
+                TextSize = 19,
+                TextColor = SkinStyle.Current.TextColor1
+            };
+            topView.AddChidren (title);
+
+            Button ItemButton = new Button () {
+                Width = Application.GetRealWidth (55),
+                Height = Application.GetRealHeight (55),
+                UnSelectedImagePath = "Item/+.png",
+                SelectedImagePath = "Item/+.png",
+                Y = Application.GetRealHeight (17),
+                X = Application.GetRealWidth (640 - 80),
+            };
+            topView.AddChidren (ItemButton);
+            ItemButton.MouseUpEventHandler += (sender1, e1) => {
+                //GuideAddHomeDialog (new RegionInfoRes () { Id = "",  Name = "" }, false);
+                GuideAddHomeDialog (new RegionInfoRes () { Id = "", Name = "" }, false);
+            };
+
+            //if (!IsHideBack) {
+            var back = new Button () {
+                Height = Application.GetRealHeight (90),
+                Width = Application.GetRealWidth (85),
+                UnSelectedImagePath = "Item/Back.png",
+                SelectedImagePath = "Item/BackSelected.png",
+            };
+            topView.AddChidren (back);
+            back.MouseUpEventHandler += (sender, e) => {
+                if (IsHideBack) {
+                    ShowIfLogoutAlter ();
+                } else {
+                    (Parent as PageLayout).PageIndex -= 1;
+                }
+
+            };
+
+            //}
+
+
+
+            #endregion
+
+            var BodyView = new FrameLayout () {
+                Width = LayoutParams.MatchParent,
+                Height = Application.GetRealHeight (1136 - 126),
+                Y = topView.Bottom,
+                BackgroundColor = SkinStyle.Current.ViewColor,
+            };
+            AddChidren (BodyView);
+
+            VerticalScrolViewMiddle = new VerticalScrolViewLayout ();
+            BodyView.AddChidren (VerticalScrolViewMiddle);
+
+            GetHomeList (showDialog);
+
+        }
+
+        /// <summary>
+        /// 鏌ヨ鎵�鏈変綇瀹呭垪琛�
+        /// </summary>
+        /// <param name="showDialog"></param>
+        void GetHomeList (bool showDialog = false)
         {
+            
             new System.Threading.Thread (() => {
                 bool needHide = true;
                 try {
@@ -39,7 +116,7 @@
 
                     var requestJson2 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj2);
                     var revertObj2 = MainPage.RequestHttps (API.GetHomePager, requestJson2);
-                    if (revertObj2.StateCode.ToUpper() == "SUCCESS") {
+                    if (revertObj2.StateCode.ToUpper () == "SUCCESS") {
                         var mResidenceRes = Newtonsoft.Json.JsonConvert.DeserializeObject<ResidenceRes> (revertObj2.ResponseData.ToString ());
                         var responseDataObj = mResidenceRes.PageData;
                         //if(responseDataObj == null && responseDataObj.Count == 0) {
@@ -55,7 +132,13 @@
                                 });
                             }
                             UserConfig.Instance.SaveUserConfig ();
-                            UserConfig.Instance.CurrentRegion = responseDataObj.Find ((obj) => obj.Id == UserConfig.Instance.CurrentRegion.Id);
+                            //2020-01-16
+                            var mHome = responseDataObj.Find ((obj) => obj.Id == UserConfig.Instance.CurrentRegion.Id);
+                            if (mHome != null) {
+                                UserConfig.Instance.CurrentRegion = mHome;
+                            } else {
+                                UserConfig.Instance.CurrentRegion = UserConfig.Instance.HomeLists [0];
+                            }
                         } else {
                             Application.RunOnMainThread (() => {
                                 MainPage.Loading.Hide ();
@@ -77,17 +160,17 @@
                         MainPage.Loading.Hide ();
                         ShowHomeListView (showDialog);
                     });
-            } catch (Exception ex) {
-                Application.RunOnMainThread (() => {
-                    MainPage.Loading.Hide ();
-                    this.RemoveFromParent ();
+                } catch (Exception ex) {
+                    Application.RunOnMainThread (() => {
+                        MainPage.Loading.Hide ();
+                        this.RemoveFromParent ();
+                        needHide = false;
+                    });
+                    Utlis.WriteLine (ex.Message);
+                } finally {
                     needHide = false;
-                });
-                Console.WriteLine (ex.Message);
-            } finally {
-                needHide = false;
-            }
-        }) { IsBackground = true }.Start ();
+                }
+            }) { IsBackground = true }.Start ();
         }
 
 
@@ -115,94 +198,87 @@
 
         }
 
-        void ShowHomeListView (bool showDialog = true)
+
+        /// <summary>
+        /// 鍔犺浇鍒锋柊鎵�鏈変綇瀹�
+        /// </summary>
+        /// <param name="ifNeedShowDialog"></param>
+        void ShowHomeListView (bool ifNeedShowDialog = false)
         {
-            RemoveAll (); 
-            #region 鏍囬
-            var topView = new FrameLayout () {
-                Y = Application.GetRealHeight (36),
-                Height = Application.GetRealHeight (90),
-            };
-            AddChidren (topView);
-
-            var title = new Button () {
-                TextAlignment = TextAlignment.Center,
-                Text= "Zones/Residences",
-                TextSize = 19,
-                TextColor = SkinStyle.Current.TextColor1
-            };
-            topView.AddChidren (title);
-
-            Button ItemButton = new Button () {
-                Width = Application.GetRealWidth (55),
-                Height = Application.GetRealHeight (55),
-                UnSelectedImagePath = "Item/+.png",
-                SelectedImagePath = "Item/+.png",
-                Y = Application.GetRealHeight (17),
-                X = Application.GetRealWidth (640 - 80),
-            };
-            topView.AddChidren (ItemButton);
-            ItemButton.MouseUpEventHandler += (sender1, e1) => {
-                //GuideAddHomeDialog (new RegionInfoRes () { Id = "",  Name = "" }, false);
-                GuideAddHomeDialog (new RegionInfoRes () { Id = "", Name = "" }, false);
-            };
-            if (!IsHideBack) {
-                var back = new Button () {
-                    Height = Application.GetRealHeight (90),
-                    Width = Application.GetRealWidth (85),
-                    UnSelectedImagePath = "Item/Back.png",
-                    SelectedImagePath = "Item/BackSelected.png",
-                };
-                topView.AddChidren (back);
-                back.MouseUpEventHandler += (sender, e) => {
-                    (Parent as PageLayout).PageIndex -= 1;
-                };
-            }
-            #endregion
-
-            var BodyView = new FrameLayout () {
-                Width = LayoutParams.MatchParent,
-                Height = Application.GetRealHeight (1136 - 126),
-                Y = topView.Bottom,
-                BackgroundColor = SkinStyle.Current.ViewColor,
-            };
-            AddChidren (BodyView);
-
-            VerticalScrolViewLayout VerticalScrolViewMiddle = new VerticalScrolViewLayout ();
-            BodyView.AddChidren (VerticalScrolViewMiddle);
-
             try {
+                VerticalScrolViewMiddle.RemoveAll ();
                 foreach (var tempHome in UserConfig.Instance.HomeLists) {
                     AddResidenceListRow (tempHome, VerticalScrolViewMiddle);
                 }
             } catch { }
 
-            //if (UserConfig.Instance.GatewayList != null && UserConfig.Instance.GatewayList.Count == 0) {
-            //    if (showDialog) {
-            //        GuideAddHomeDialog (UserConfig.Instance.HomeLists [0], true);
-            //        UserConfig.Instance.CurrentRegion = UserConfig.Instance.HomeLists [0];
-            //    }
-            //}
 
-            if (!UserConfig.Instance.CheckHomeGateways()) {
-                if (showDialog) {
+            if (!UserConfig.Instance.CheckHomeGatewaysNotEmpty ()) {
+                if (ifNeedShowDialog) {
                     GuideAddHomeDialog (UserConfig.Instance.HomeLists [0], true);
                     UserConfig.Instance.CurrentRegion = UserConfig.Instance.HomeLists [0];
                 }
             }
+            try {
+                if (IsNeedGoToGuideAddGatewayView) {
+                    IsNeedGoToGuideAddGatewayView = false;
+                    if (UserConfig.Instance.CurrentRegion.IsOthreShare) {
+                        //鎻愮ず娌℃湁鍒嗕韩浣忓畢鐨勬潈闄�
+                        new Alert ("", ErrorCode.InsufficientAuthority, "Close").Show ();
+                        return;
+                    }
+
+                    GotoGuideAddGatewayView (UserConfig.Instance.CurrentRegion);
+
+                }
+            } catch { }
+
         }
+
+        /// <summary>
+        /// 鎻愮ず鐢ㄦ埛鏄惁閫�鍑虹櫥褰�
+        /// </summary>
+        void ShowIfLogoutAlter ()
+        {
+            var logoutAlert = new Alert ("", "Log out?", "No", "Yes");
+            logoutAlert.Show ();
+            logoutAlert.ResultEventHandler += (sender1, e1) => {
+                if (e1) {
+                    AccountLogout ();
+                }
+            };
+
+        }
+
+        /// <summary>
+        /// 閫�鍑虹櫥褰�
+        /// </summary>
+        void AccountLogout ()
+        {
+            try {
+                this.RemoveFromParent ();
+                MainPage.LoginUser.LastTime = DateTime.Now.AddDays (-30);
+                MainPage.LoginUser.SaveUserInfo ();
+                new AccountLogin ().Show ();
+            } catch {
+
+            }
+
+        }
+
+
 
         /// <summary>
         /// 鍔犺浇鐣岄潰
         /// </summary>
         /// <param name="home">Home.</param>
-        /// <param name="VerticalScrolViewMiddle">Vertical scrol view middle.</param>
-        void AddResidenceListRow (RegionInfoRes home, VerticalScrolViewLayout VerticalScrolViewMiddle)
+        /// <param name="mVerticalScrolViewMiddle">Vertical scrol view middle.</param>
+        void AddResidenceListRow (RegionInfoRes home, VerticalScrolViewLayout mVerticalScrolViewMiddle)
         {
             var rowView = new RowLayout () {
                 Height = Application.GetRealHeight (110),
             };
-            VerticalScrolViewMiddle.AddChidren (rowView);
+            mVerticalScrolViewMiddle.AddChidren (rowView);
 
             Button btnRowLine = new Button () {
                 Y = Application.GetRealHeight (107),
@@ -213,7 +289,7 @@
 
             var btnPoint = new Button () {
                 Width = Application.GetRealWidth (10),
-                Height = Application.GetRealHeight (10),
+                Height = Application.GetRealWidth (10),
                 X = Application.GetRealWidth (50),
                 Gravity = Gravity.CenterVertical,
                 UnSelectedImagePath = "Item/Point.png",
@@ -237,7 +313,7 @@
                 Button FromSharingButton = new Button () {
                     X = Application.GetRealWidth (480),
                     Width = Application.GetRealWidth (30),
-                    Height = Application.GetRealHeight (30),
+                    Height = Application.GetRealWidth (30),
                     Gravity = Gravity.CenterVertical,
                     UnSelectedImagePath = "CrabtreeAdd/FromSharing.png",
                     SelectedImagePath = "CrabtreeAdd/FromSharing.png",
@@ -251,10 +327,6 @@
             };
             rowView.AddChidren (goNextButton);
 
-         
-      
-
-
             Button rightButton1 = new Button () {
                 X = Application.GetRealWidth (550),
                 Width = Application.GetRealWidth (28),
@@ -265,9 +337,6 @@
             };
             rowView.AddChidren (rightButton1);
 
-
-           
-
             EventHandler<MouseEventArgs> eHandler = (sender, e) => {
                 if (home.Id == UserConfig.Instance.CurrentRegion.Id) {
                     if (home.IsOthreShare) {
@@ -275,11 +344,8 @@
                         new Alert ("", ErrorCode.InsufficientAuthority, "Close").Show ();
                         return;
                     }
-                    //UserConfig.Instance.GatewayMAC = gatewayMAC;
-                    var addGatewayDialog = new GuideAddGateway ();
-                    (Parent as PageLayout).AddChidren (addGatewayDialog);
-                    addGatewayDialog.ShowPage (home);
-                    (Parent as PageLayout).PageIndex = (Parent as PageLayout).ChildrenCount - 1;
+
+                    GotoGuideAddGatewayView (home);
                 } else {
                     ChangeRegion (home);
                 }
@@ -422,7 +488,7 @@
                                     var revertObj2 = MainPage.RequestHttps (API.DelHome, requestJson2);
                                     if (revertObj2.StateCode.ToUpper () == "SUCCESS") {
                                         Application.RunOnMainThread (() => {
-                                            ShowHomeList ();
+                                            GetHomeList ();
                                         });
                                     } else {
                                         ShowDelHomeErrorInfo (revertObj2.StateCode);
@@ -472,6 +538,54 @@
         }
 
         /// <summary>
+        /// 鍚姩鏈湴妯″紡
+        /// </summary>
+        void EnableLocalMode () {
+            MainPage.AddTip ("Enable local mode.");
+            Utlis.ShowAppLinkStatus (AppLinkStatus.WiFiOffline);
+            CommonPage.IsRemote = false;
+            SmartHome.MqttCommon.DisConnectRemoteMqttClient ("EnableLocalMode");
+        }
+
+        /// <summary>
+        /// 鍚姩杩滅▼妯″紡
+        /// </summary>
+        void EnableRemoteMode ()
+        {
+            MainPage.AddTip ("Restore remote mode.");
+            Utlis.ShowAppLinkStatus (AppLinkStatus.CloudUnlink);
+            CommonPage.IsRemote = true;
+        }
+
+        /// <summary>
+        ///  璺宠浆缃戝叧鎼滅储椤甸潰
+        /// </summary>
+        /// <param name="home"></param>
+        void GotoGuideAddGatewayView (RegionInfoRes home) {
+            try {
+                //杩滅▼杩炴帴鐨勬椂鍊欑姝� 鎼滅储缃戝叧鍜屾坊鍔犺澶�
+                if (CommonPage.IsRemote) {
+                    ////褰撳墠澶勪簬杩滅▼杩炴帴妯″紡锛屾棤娉曡繘鍏ユ悳绱㈢綉鍏抽〉闈€�傝鍏堝垏鎹㈠洖鏈湴杩炴帴妯″紡銆�
+                    //new Alert ("", "Currently in remote connection mode, unable to enter the search gateway page. Please switch back to local connection mode first.", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    //return;
+
+                    //2020-06-29 鍚姩鏈湴閫氫俊妯″紡
+                    EnableLocalMode ();
+                }
+
+
+                var addGatewayDialog = new GuideAddGateway ();
+                (Parent as PageLayout).AddChidren (addGatewayDialog);
+                addGatewayDialog.ShowPage (home);
+                (Parent as PageLayout).PageIndex = (Parent as PageLayout).ChildrenCount - 1;
+            } catch {
+
+                Utlis.WriteLine ("============>GotoGuideAddGatewayView 璺宠浆澶辫触 ");
+            }
+            
+        }
+
+        /// <summary>
         /// 鏇存崲鏈湴鍖哄煙
         /// </summary>
         /// <param name="home">Home.</param>
@@ -480,8 +594,9 @@
         void ChangeRegion (RegionInfoRes home, bool goHomePage = true, bool bNeedCheckAddRoom = false, bool goToGuideAddGatewayView = false)
         {
             if (home == null || string.IsNullOrEmpty (home.Id)) return;
-
-            MainPage.Loading.Start ("Please wait...");
+            Application.RunOnMainThread (() => {
+                MainPage.Loading.Start ("Please wait...");
+            });
             System.Threading.Tasks.Task.Run (() => {
                 try {
                     //if (home.RegionID != UserConfig.Instance.CurrentRegion.RegionID) {
@@ -496,7 +611,7 @@
                         System.IO.FileInfo fileInfo = new System.IO.FileInfo (IO.FileUtils.RootPath + fileName);
                         if (fileInfo.Exists) {
                             fileInfo.MoveTo (oldRegionRootPath + fileName);
-                            Console.WriteLine ("move file : " + fileName);
+                            Utlis.WriteLine ("move file : " + fileName);
                         }
                         index++;
                         Application.RunOnMainThread (() => {
@@ -511,7 +626,17 @@
                     UserConfig.Instance.SaveUserConfig ();
                     Room.InitAllRoom ();
                     Application.RunOnMainThread (() => {
-                        ShowHomeList (false);
+                        if (goToGuideAddGatewayView) {
+                            IsNeedGoToGuideAddGatewayView = true;
+                            //2020-01-16
+                            //GotoGuideAddGatewayView (home);
+
+                            //var addGatewayDialog = new GuideAddGateway ();
+                            //UserMiddle.guidePageView.AddChidren (addGatewayDialog);
+                            //addGatewayDialog.ShowPage (home);//guidePageView
+                            //UserMiddle.guidePageView.PageIndex = 1;
+                        }
+                        GetHomeList (false);
 
 
                         if (goHomePage) {
@@ -519,19 +644,14 @@
                             new Alert ("", Language.StringByID (R.MyInternationalizationString.SwitchRegionSuccessfully),
                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                             //this.RemoveFromParent ();
-                            CommonPage.IsRemote = false;
-                            EquipmentPublicClass.CheckLinkRemote (2);
+                            //CommonPage.IsRemote = false;
+                            EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus);
                         }
                         if (bNeedCheckAddRoom) {
                             CheckIfNeedAddRoom ();
                         }
 
-                        if (goToGuideAddGatewayView) {
-                            var addGatewayDialog = new GuideAddGateway ();
-                            UserMiddle.guidePageView.AddChidren (addGatewayDialog);
-                            addGatewayDialog.ShowPage (home);//guidePageView
-                            UserMiddle.guidePageView.PageIndex = 1;
-                        }
+                        
                     });
                     MainPage.LoginUser.SaveUserInfo ();
                     
@@ -542,7 +662,7 @@
                         new Alert ("", Language.StringByID (R.MyInternationalizationString.CheckInternet),
                                    Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                     });
-                    Console.WriteLine (ex.Message);
+                    Utlis.WriteLine (ex.Message);
                 } finally {
                     Application.RunOnMainThread (() => {
                         MainPage.Loading.Hide ();
@@ -637,42 +757,71 @@
                     new Alert ("", Language.StringByID (R.MyInternationalizationString.PleaseEnterZoneName), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                     return;
                 }
-                if (isChangeName) {
-                    //home.Name = button.Text = etZoneName.Text;
-                    var requestObj2 = new EditHomeObj () { HomeId = home.Id, Name = etZoneName.Text, LoginAccessToken = MainPage.LoginUser.LoginTokenString };
-                    string urlHead = MainPage.RequestHttpsHost;
-                    if (requestObj2.IsOtherAccountCtrl) {
-                        urlHead = UserConfig.Instance.MasterAccountRequestBaseUrl;
-                        requestObj2.LoginAccessToken = UserConfig.Instance.MasterAccountToken;
-                    }
 
-                    var requestJson2 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj2);
-                    var revertObj2 = MainPage.RequestHttps (API.EditHome, requestJson2, urlHead);
-                    if (revertObj2.StateCode.ToUpper () != "SUCCESS") {
-                        ShowEditHomeErrorInfo (revertObj2.StateCode);
-                        return;
-                    }
-                    home.Name = button.Text = etZoneName.Text;
-                    IO.FileUtils.ReNameFoler (UserConfig.Instance.CurrentRegion.Name, home.Name);
-                    return;
-                }
 
-                //ChangeRegion (home, false);
-                EditResidence (home, etZoneName.Text.Trim (), guide);
+                //if (isChangeName) {
+                //    //home.Name = button.Text = etZoneName.Text;
+                //    var requestObj2 = new EditHomeObj () { HomeId = home.Id, Name = etZoneName.Text, LoginAccessToken = MainPage.LoginUser.LoginTokenString };
+                //    string urlHead = MainPage.RequestHttpsHost;
+                //    if (requestObj2.IsOtherAccountCtrl) {
+                //        urlHead = UserConfig.Instance.MasterAccountRequestBaseUrl;
+                //        requestObj2.LoginAccessToken = UserConfig.Instance.MasterAccountToken;
+                //    }
 
-               
-                //if (guide) {
-
-                //    //ShowHomeList ();
-                //    EditResidence (home, etZoneName.Text.Trim ());
-                //    var addGatewayDialog = new GuideAddGateway ();
-                //    UserMiddle.guidePageView.AddChidren (addGatewayDialog);
-                //    addGatewayDialog.ShowPage (home);//guidePageView
-                //    UserMiddle.guidePageView.PageIndex = 1;
-                //} else {
-                //    EditResidence (home, etZoneName.Text.Trim ());
-                    
+                //    var requestJson2 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj2);
+                //    var revertObj2 = MainPage.RequestHttps (API.EditHome, requestJson2, urlHead);
+                //    if (revertObj2.StateCode.ToUpper () != "SUCCESS") {
+                //        ShowEditHomeErrorInfo (revertObj2.StateCode);
+                //        return;
+                //    }
+                //    home.Name = button.Text = etZoneName.Text;
+                //    IO.FileUtils.ReNameFoler (UserConfig.Instance.CurrentRegion.Name, home.Name);
+                //    return;
                 //}
+
+                //EditResidence (home, etZoneName.Text.Trim (), guide);
+
+
+                //2020-04-26
+                MainPage.Loading.Start ("Please wait...");
+                System.Threading.Tasks.Task.Run (() => {
+
+                    try {
+
+                        if (isChangeName) {
+                            //home.Name = button.Text = etZoneName.Text;
+                            var requestObj2 = new EditHomeObj () { HomeId = home.Id, Name = etZoneName.Text, LoginAccessToken = MainPage.LoginUser.LoginTokenString };
+                            string urlHead = MainPage.RequestHttpsHost;
+                            if (requestObj2.IsOtherAccountCtrl) {
+                                urlHead = UserConfig.Instance.MasterAccountRequestBaseUrl;
+                                requestObj2.LoginAccessToken = UserConfig.Instance.MasterAccountToken;
+                            }
+
+                            var requestJson2 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj2);
+                            var revertObj2 = MainPage.RequestHttps (API.EditHome, requestJson2, urlHead);
+                            if (revertObj2.StateCode.ToUpper () != "SUCCESS") {
+                                ShowEditHomeErrorInfo (revertObj2.StateCode);
+                                return;
+                            }
+                            Application.RunOnMainThread (() => {
+                                home.Name = button.Text = etZoneName.Text;
+                            });
+                            IO.FileUtils.ReNameFoler (UserConfig.Instance.CurrentRegion.Name, home.Name);
+                            return;
+                        }
+
+                        EditResidence (home, etZoneName.Text.Trim (), guide);
+
+
+                    } catch {
+                        //MainPage.FailureToServer ();
+                    } finally {
+                        Application.RunOnMainThread (() => {
+                            MainPage.Loading.Hide ();
+                        });
+                    }
+                });
+
             };
 
             if(!guide)
@@ -724,7 +873,7 @@
                     //鍒涘缓浣忓畢鎴愬姛锛屽垏鎹㈠埌璇ヤ綇瀹�
                     var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>> (revertObj21.ResponseData.ToString ());
                     if (responseDataObj != null && responseDataObj.Count > 0) {
-                        ChangeRegion (responseDataObj [0], false, true, goToGuideAddGatewayView);
+                        ChangeRegion (responseDataObj [0], true, true, goToGuideAddGatewayView);
                       
                     } 
                 } else {

--
Gitblit v1.8.0