From 56c4924b268da500483bd2de9522db5b34965120 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 09 四月 2020 13:35:10 +0800 Subject: [PATCH] 20200409 --- Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs | 48 +++++++++++++++++++++++++++--------------------- 1 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs index 27797e3..ef9140f 100644 --- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs +++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs @@ -32,6 +32,10 @@ myLoading.Hide (); btnCloseLoading.RemoveFromParent (); WirelessConfig (new byte [] { 1 });//close + if (CommonPage.newDevice > 0) { + CommonPage.newDevice = 0; + SearchDeviceList (); + } }); }; @@ -154,7 +158,7 @@ serverIPBytes = Control.ControlBytesSendHasReturn (Command.ReadGatewayServerIP, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); gatewayDeicve.Remote_GroupName = MainPage.LoginUser.AccountString;//UserConfig.Instance.CurrentRegion.RegionName; - gatewayDeicve.Remote_ProjectName = gatewayDeicve.MAC.Replace(".","");//UserConfig.Instance.CurrentRegion.RegionName; + gatewayDeicve.Remote_ProjectName = gatewayDeicve.MAC.Replace (".", "");//UserConfig.Instance.CurrentRegion.RegionName; gatewayDeicve.Remote_UserName = "Admin"; gatewayDeicve.Remote_Password = "c" + MainPage.LoginUser.MasterID; byte [] ggn = new byte [20]; @@ -176,7 +180,7 @@ byte [] macAddress = Control.ControlBytesSendHasReturn (Command.ReadDeviceMac, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); - + gatewayBytes [0] = 2;//杩滅▼鏍囩ず Array.Copy (ggn, 0, gatewayBytes, 1, 20 < ggn.Length ? 20 : ggn.Length); Array.Copy (gpn, 0, gatewayBytes, 21, 20 < gpn.Length ? 20 : gpn.Length); @@ -265,7 +269,7 @@ Application.RunOnMainThread (() => { new Alert ("", "Communication abnormality,gateway failed to bind residence.Please try again.", Language.StringByID (R.MyInternationalizationString.Close)).Show (); if (MainPage.LoginUser.AccountString == "464027401@qq.com") { - new Alert ("22:"+respone.StateCode, respone.ErrorInfo, Language.StringByID (R.MyInternationalizationString.Close)).Show (); + new Alert ("22:" + respone.StateCode, respone.ErrorInfo, Language.StringByID (R.MyInternationalizationString.Close)).Show (); } }); } @@ -368,7 +372,8 @@ th = null; Application.RunOnMainThread (() => { MainPage.Loading.Hide (); - if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR) { + if (gatewayDeicve.Type == DeviceType.OnePortWirelessFR && CommonPage.newDevice==0) { + CommonPage.newDevice = 0; Control.ControlBytesSend (Command.GotoConfigMode, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); //new Alert ("", "缃戝叧宸茬粡杩涘叆閰嶉妯″紡锛岃鎵嬪姩鏂拌澶囪繘鍏ラ厤棰戞ā寮忋��", "Close").Show (); new Alert ("", "Searching for new devices, Please make sure all new devices are in configuration mode.", "OK").Show (); @@ -612,23 +617,24 @@ //} if (config) { - System.Threading.Tasks.Task.Factory.StartNew (() => { - try { - byte bigClass = common.BigClass; - byte minClass = common.MinClass; - int count = common.LoopCount; - for (int k = 1, j = 0; k <= count; k++) { - if (Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, common.SubnetID, common.DeviceID, new byte [] { bigClass, minClass, (byte)k }) == null) { - j++; - //杩炵画涓ゆ璇诲彇涓嶅埌鏁版嵁鍒欒烦鍑鸿寰幆 - if (j == 2 && k == 2) - break; - } - } - } catch (Exception ex) { - Console.WriteLine ("Cinfig Read Device Loop Info " + ex.Message); - } - }); + CommonPage.newDevice++; + //System.Threading.Tasks.Task.Factory.StartNew (() => { + // try { + // byte bigClass = common.BigClass; + // byte minClass = common.MinClass; + // int count = common.LoopCount; + // for (int k = 1, j = 0; k <= count; k++) { + // if (Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, common.SubnetID, common.DeviceID, new byte [] { bigClass, minClass, (byte)k }) == null) { + // j++; + // //杩炵画涓ゆ璇诲彇涓嶅埌鏁版嵁鍒欒烦鍑鸿寰幆 + // if (j == 2 && k == 2) + // break; + // } + // } + // } catch (Exception ex) { + // Console.WriteLine ("Cinfig Read Device Loop Info " + ex.Message); + // } + //}); } #endregion -- Gitblit v1.8.0