// Process each found device in the event handler void deviceLocator_DeviceAvailable(object sender, DeviceAvailableEventArgs e) { var originalHeaders = e.DiscoveredDevice.ResponseHeaders; var headerDict = originalHeaders == null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase); var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase); var args = new GenericEventArgs<UpnpDeviceInfo> { Argument = new UpnpDeviceInfo { Location = e.DiscoveredDevice.DescriptionLocation, Headers = headers } }; EventHelper.FireEventIfNotNull(DeviceDiscovered, this, args, _logger); }
public void DeviceAvailableEventArgs_Constructor_ThrowsOnNullDevice() { var args = new DeviceAvailableEventArgs(null, true); }