wxr
2020-04-09 56c4924b268da500483bd2de9522db5b34965120
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 ();
                    }
                });
            };
@@ -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