From 2f17a7041e7fbc57b945ed10afa910900afff3b9 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 27 六月 2022 13:30:38 +0800
Subject: [PATCH] 备份

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs
index 19d329c..aaf6234 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/MigrationServer.cs
@@ -559,16 +559,26 @@
                             }
                             var visionString = Encoding.GetEncoding ("gb2312").GetString (bytes);
 
-
                             int result = -99;
 
-
-                            if (visionString.Contains("Ind_V03.01U_2021/07/12")) {
+                            if (visionString.Contains ("Ind_C03.02U_2022/06/22")) {
                                 Application.RunOnMainThread (() => {
                                     btnTipMsg.Text = "Gateway firmware has been upgraded, initializing gateway.";
                                     btnTipMsg.TextColor = SkinStyle.Current.TextColor;
                                 });
                                 result = 100;
+                            } else if (!visionString.Contains ("Ind_V02.35U_2019/06/25")) {//鐩墠鍙厑璁稿崌绾ц繖涓浐浠剁殑缃戝叧
+                                Application.RunOnMainThread (() => {
+                                    btnTipTitle.Text = "The gateway does not support automatic migration. Please contact technical support.";
+                                    btnTipTitle.Height = Application.GetRealHeight (150);
+                                    btnTipTitle.TextColor = SkinStyle.Current.DelColor;
+                                    btnTipMsg.Text = "";
+                                    etPwd.Visible = false;
+                                    loading.Hide ();
+                                    btnSave.Visible = false;
+                                    btnClose.Width = Application.GetRealWidth (500);
+                                });
+                                return;
                             } else {
                                 Application.RunOnMainThread (() => {
                                     btnTipMsg.Text = "Upgrading gateway.";
@@ -589,7 +599,7 @@
                                 while (true) {
                                     var ub = MainPage.GatewayStatus.Split ("_");
                                     if (ub.Length > 1) {
-                                         result = Convert.ToInt32 (ub [1]);
+                                        result = Convert.ToInt32 (ub [1]);
                                         //if (result < result0 && result0 < 100)
                                         {
                                             //result = result0;
@@ -611,16 +621,17 @@
                                             btnTipMsg.Text = "Gateway upgrade succeeded. Initializing gateway.";
                                             btnTipMsg.TextColor = SkinStyle.Current.TextColor;
                                         });
+                                        //鍒濆鍖栨爣璁�
+                                        MainPage.GatewayStatus = "";
                                         break;
-                                    }
-                                     else {
+                                    } else {
                                         if (upgradeData.Count >= result) {
-                                            var listPack = upgradeData [result-1];//
+                                            var listPack = upgradeData [result - 1];//
                                             byte [] packData = new byte [2 + listPack.Count];
                                             packData [0] = Convert.ToByte (result / 256);
-                                            packData [1] = Convert.ToByte (result % 256 );
+                                            packData [1] = Convert.ToByte (result % 256);
                                             Array.Copy (listPack.ToArray (), 0, packData, 2, listPack.Count);
-                                            Console.WriteLine ("packId"+result);
+                                            Console.WriteLine ("packId" + result);
                                             SendUpgradeData (common.SubnetID, common.DeviceID, packData);
 
                                         }
@@ -651,6 +662,8 @@
                                     if (MainPage.GatewayStatus != "Initialization_complete") {
                                         System.Threading.Thread.Sleep (100);
                                     } else if (initiaIndex == 0) {
+                                        //鍒濆鍖栨爣璁�
+                                        MainPage.GatewayStatus = "";
                                         Application.RunOnMainThread (() => {
                                             btnTipMsg.Text = "Successfully initialized the gateway. Opening the gateway remote configuration.";
                                             btnTipMsg.TextColor = SkinStyle.Current.TextColor;

--
Gitblit v1.8.0