Exemple #1
0
 /// <summary>
 /// Finds services by service type asynchronously using a timeout period.
 /// </summary>
 /// <param name="serviceType">The service type to search for or null for all.</param>
 /// <param name="timeoutMS">The maximum timeout time in milliseconds to wait.</param>
 /// <param name="maxDevices">The maximum number of devices to find before returning.</param>
 /// <param name="servicesFound">
 /// The delegate to call when async operation is complete.<para />NOTE: this delegate is executed
 /// in a different to the calling thread.</param>
 /// <param name="addressFamily">The address family to search in. (Vista or above only).</param>
 /// <param name="resolveNetworkInterfaces">True to resolve network interface Guids.</param>
 /// <returns>A Devices list containing the found devices.</returns>
 public static void FindServicesAsync(
     string serviceType,
     int timeoutMS,
     int maxDevices,
     ServicesFoundDelegate servicesFound,
     AddressFamilyFlags addressFamily = AddressFamilyFlags.IPvBoth,
     bool resolveNetworkInterfaces    = false)
 {
     FindDevicesAsync(
         serviceType, timeoutMS, maxDevices,
         (devices, completed) => { servicesFound(devices.FindServices(serviceType, true), completed); },
         addressFamily, resolveNetworkInterfaces);
 }
 /// <summary>
 /// Finds services by service type asynchronously using a timeout period.
 /// </summary>
 /// <param name="serviceType">The service type to search for or null for all.</param>
 /// <param name="timeoutMS">The maximum timeout time in milliseconds to wait.</param>
 /// <param name="maxDevices">The maximum number of devices to find before returning.</param>
 /// <param name="servicesFound">
 /// The delegate to call when async operation is complete.<para />NOTE: this delegate is executed
 /// in a different to the calling thread.</param>
 /// <param name="addressFamily">The address family to search in. (Vista or above only).</param>
 /// <param name="resolveNetworkInterfaces">True to resolve network interface Guids.</param>
 /// <returns>A Devices list containing the found devices.</returns>
 public static void FindServicesAsync(
     string serviceType,
     int timeoutMS,
     int maxDevices,
     ServicesFoundDelegate servicesFound,
     AddressFamilyFlags addressFamily = AddressFamilyFlags.IPvBoth,
     bool resolveNetworkInterfaces = false)
 {
     FindDevicesAsync(
         serviceType, timeoutMS, maxDevices,
         (devices, completed) => { servicesFound(devices.FindServices(serviceType, true), completed); },
         addressFamily, resolveNetworkInterfaces);
 }