Ejemplo n.º 1
0
        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
            {
            }
        }
Ejemplo n.º 2
0
 private void OnDeviceDiscovered(object sender, DeviceDiscoveryEventArgs e)
 {
     AddDeviceToList(listBox1, e.Device);
 }