| | |
| | | #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), |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |