| | |
| | | using Newtonsoft.Json; |
| | | using HDL_ON.Entity; |
| | | using System.Collections.Generic; |
| | | |
| | | using HDL_ON.DriverLayer; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | |
| | | |
| | | contentView.BeginHeaderRefreshingAction += () => |
| | | { |
| | | 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.SearchLocalGateway(); |
| | | //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}"); |
| | | // } |
| | | // } |
| | | // } |
| | | // }; |
| | | new Control_Udp().SearchLocalGateway(); |
| | | contentView.EndHeaderRefreshing(); |
| | | }; |
| | | |
| | |
| | | |
| | | switch (device.gateway_type) |
| | | { |
| | | case 4: |
| | | case "4": |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/DeviceIcon/VoicePanelIcon.png"; |
| | | break; |
| | | default: |