陈嘉乐
2020-12-01 e08a444a9d7acea0cf39f50d22d29179f6a59292
HDL_ON/UI/UI2/4-PersonalCenter/SearchDevice/SearchDevicePage.cs
@@ -34,39 +34,37 @@
            {
                deviceIpList.Clear();
                contentView.RemoveAll();
                DriverLayer.Control.ins.ChangeCommunicationMode(DriverLayer.CommunicationMode.local_BusUdp);
                UdpSocket._BusSocket.SearchNetDeviceAction = (jto) =>
                {
                    var device = JsonConvert.DeserializeObject<DeviceModule>(jto.ToString());
                    if (device != null)
                    {
                        lock (deviceIpList)
                        {
                            if (!deviceIpList.Contains(device.ip_address))
                            {
                                deviceIpList.Add(device.ip_address);
                                MainPage.Log($"搜索到网络设备:{device.ip_address}");
                                Application.RunOnMainThread(() =>
                                {
#if DEBUG
#else
                                    if(device.gateway_type== 4)
#endif
                                    {
                                        LoadRow(device);
                                    }
                                });
                            }
                            else
                            {
                                MainPage.Log($"已加载该IP设备:{device.ip_address}");
                            }
                        }
                    }
                };
                DriverLayer.Control.ins.myUdp.ReadGatewayIP();
                //DriverLayer.Control.ins.ChangeCommunicationMode(DriverLayer.CommunicationMode.local_BusUdp);
//                UdpSocket._BusSocket.SearchNetDeviceAction = (jto) =>
//                {
//                    var device = JsonConvert.DeserializeObject<DeviceModule>(jto.ToString());
//                    if (device != null)
//                    {
//                        lock (deviceIpList)
//                        {
//                            if (!deviceIpList.Contains(device.ip_address))
//                            {
//                                deviceIpList.Add(device.ip_address);
//                                MainPage.Log($"搜索到网络设备:{device.ip_address}");
//                                Application.RunOnMainThread(() =>
//                                {
//#if DEBUG
//#else
//                                    if(device.gateway_type== 4)
//#endif
//                                    {
//                                        LoadRow(device);
//                                    }
//                                });
//                            }
//                            else
//                            {
//                                MainPage.Log($"已加载该IP设备:{device.ip_address}");
//                            }
//                        }
//                    }
//                };
                DriverLayer.Control.Ins.myUdp.SearchLocalGateway();
                contentView.EndHeaderRefreshing();
            };