protected void OnMessageReceived(object sender, DiscoveryMessageEventArgs e) { TestMessages TestMessage = new TestMessages(); string message = e.Message; message = message.Replace('\n', ' '); message = message.Replace('\r', ' '); message = message.Replace('\t', ' '); message = message.Replace(" ", " "); message = message.Replace(" ", " "); message = message.Replace(" ", " "); message = message.Replace(" ", " "); message = message.Replace("> <", "><"); message = message.Replace("> <", "><"); try { RD.ProbeMatchesType match = (RD.ProbeMatchesType)TestMessage.Parse_SoapMessage(message, typeof(RD.ProbeMatchesType)); DeviceDiscovered device = GetDevice(match, e.Source.Address); if (device != null) { DeviceDiscoveryEventArgs args = new DeviceDiscoveryEventArgs(device); if (Discovered != null) { Discovered(this, args); } } } catch { } }
private void OnDeviceDiscovered(object sender, DeviceDiscoveryEventArgs e) { AddDeviceToList(listBox1, e.Device); }