1
wxr
2023-03-31 7e42cc13a14b7de31c9f5d5c61cdf24f3246335d
Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs
@@ -399,8 +399,9 @@
            #endregion
            #region ---数据接收---
            if (UserConfig.Instance.internetStatus == 2) {
            #region ---测试按钮---
            //if (UserConfig.Instance.internetStatus == 2) {
            if (true) {
                var ConmmunicationTestView = new FrameLayout () {
                    Width = Application.GetRealWidth (640),
                    Height = Application.GetRealHeight (100),
@@ -619,19 +620,24 @@
                    MainPage.Loading.Start ();
                });
                CommonPage.IsRemote = false;
                CommonPage.FindGateway = true;
                var result = Control.ControlBytesSendHasReturn (Command.ReadDeviceMac, common.SubnetID, common.DeviceID, new byte [] { }, false);
                CommonPage.FindGateway = false;
                if (result != null) {
                    Application.RunOnMainThread (() => {
                        btnLocalTest.Text = "Local UDP communication : succeeded.";
                    });
                } else {
                    Application.RunOnMainThread (() => {
                        btnLocalTest.Text = "Local UDP communication : failed.";
                    });
                //2020-07-23 连接WiFi才检测本地
                if (UserConfig.Instance.internetStatus == 2) {
                    CommonPage.IsRemote = false;
                    CommonPage.FindGateway = true;
                    var result = Control.ControlBytesSendHasReturn (Command.ReadDeviceMac, common.SubnetID, common.DeviceID, new byte [] { }, false);
                    CommonPage.FindGateway = false;
                    if (result != null) {
                        Application.RunOnMainThread (() => {
                            btnLocalTest.Text = "Local UDP communication : succeeded.";
                        });
                    } else {
                        Application.RunOnMainThread (() => {
                            btnLocalTest.Text = "Local UDP communication : failed.";
                        });
                    }
                }
                //UDP communication to Sever : succeeded.
                var gateWay = Newtonsoft.Json.JsonConvert.DeserializeObject<GatewayBase> (gateWayString);
@@ -668,12 +674,17 @@
                                    btnSeverTest.Text = "Gateway UDP communication to Sever : failed.";
                                    return;
                                });
                            } else {
                                Application.RunOnMainThread (() => {
                                    btnSeverTest.Text = "UDP communication to Sever : succeeded.";
                                    return;
                                });
                            }
                        }
                        Application.RunOnMainThread (() => {
                            btnSeverTest.Text = "UDP communication to Sever : succeeded.";
                            return;
                        });
                        //Application.RunOnMainThread (() => {
                        //    btnSeverTest.Text = "UDP communication to Sever : succeeded.";
                        //    return;
                        //});
                    }
                } catch (Exception ex) {
                    Console.WriteLine (ex.Message);