From 56bbd33ccbc6ddc457bf96b7a6842f9a07aebbe7 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 12 一月 2022 17:02:36 +0800
Subject: [PATCH] 2022-01-12 1.修复计算溢出问题,无法写配置问题

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs
index 5345188..9cf86fa 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,11 +309,10 @@
                                     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
                                     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 ();
+                                        }
                                     });
                                 } else {
                                     goNext = true;

--
Gitblit v1.8.0