From 20f70e3446df19bf5d0faaae9f7bd58fd0fc4bcc Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 04 八月 2023 12:06:51 +0800
Subject: [PATCH] 轮询备份

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs
index 5345188..b42a61f 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs
@@ -295,7 +295,13 @@
                                 var bingResidenceIdBytes = Control.ControlBytesSendHasReturn (Command.Read_APP_Data_STORE_1D5C_CMD, common.SubnetID, common.DeviceID, new byte [] { });
                                 if (bingResidenceIdBytes == null) {
                                     Application.RunOnMainThread (() => {
-                                        new Alert ("", "No response from gateway. Please make sure the gateway is online and its firmware is up to date.", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                        try {
+                                            if (inThisView) {
+                                                new Alert ("", "No response from gateway. Please make sure the gateway is online and its firmware is up to date.", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                            }
+                                        } catch {
+
+                                        }
                                     });
                                 }
                                 int bingResideceId = 0;
@@ -303,12 +309,15 @@
                                     bingResideceId += (int)(bingResidenceIdBytes [i] * Math.Pow (256, 3 - i));
                                 }
                                 if (bingResideceId != UserConfig.Instance.CurrentRegion.RegionID && bingResideceId != 0) {
-//#if DEBUG
-//                                    Control.ControlBytesSendHasReturn (Command.Write_APP_Data_STORE_1D5E_CMD, common.SubnetID, common.DeviceID, new byte [] { 0, 0, 0, 0 });
-//#endif
+#if DEBUG   
+                                    goNext = true;
+#else
                                     Application.RunOnMainThread (() => {
-                                        new Alert ("", "This gateway has been bound to a residence, please reset it before binding to another residence.", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                        if (inThisView) {
+                                            new Alert ("", "This gateway has been bound to a residence, please reset it before binding to another residence.", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                        }
                                     });
+#endif
                                 } else {
                                     goNext = true;
                                 }
@@ -374,7 +383,7 @@
                     Application.RunOnMainThread (() => {
                         MainPage.Loading.Start ("Searching for gateway...");
                     });
-                    #region 鎼滅储璁惧
+#region 鎼滅储璁惧
                     CommonPage.LocalPhoneFindDevice = true;
                     CommonPage.RandomHigh = (byte)new Random ().Next (255);
                     CommonPage.RandomLow = (byte)new Random ().Next (255);
@@ -429,7 +438,7 @@
                     CommonPage.FindGateway = false;
 
                     CommonPage.LocalPhoneFindDevice = false;
-                    #endregion
+#endregion
                 } catch (Exception ex) {
                     Console.WriteLine (ex.ToString ());
                 } finally {

--
Gitblit v1.8.0