Share via


GetAllDevicesInfoCompletedEventArgs Constructor (ReadOnlyDeviceInfoCollection, Exception)

 

Initializes a new instance of the GetAllDevicesInfoCompletedEventArgs class with the specified device list and the specified exception.

Namespace:   Microsoft.WindowsServerSolutions.Common.Devices
Assembly:  DevicesOM (in DevicesOM.dll)

Syntax

public GetAllDevicesInfoCompletedEventArgs(
    ReadOnlyDeviceInfoCollection deviceInfoList,
    Exception error
)
public:
GetAllDevicesInfoCompletedEventArgs(
    ReadOnlyDeviceInfoCollection^ deviceInfoList,
    Exception^ error
)
Public Sub New (
    deviceInfoList As ReadOnlyDeviceInfoCollection,
    error As Exception
)

Parameters

Examples

The following code example shows how to use the GetAllDevicesInfoCompletedEventArgs object:

DevicesManager dm = new DevicesManager();
dm.Connect();
dm.GetAllDevicesInfoCompleted += 
   new EventHandler<GetAllDevicesInfoCompletedEventArgs>(
      dm_GetAllDevicesInfoCompleted);

The following code example shows the delegate method:

static void dm_GetAllDevicesInfoCompleted(object sender, 
   GetAllDevicesInfoCompletedEventArgs e)
{
   if (e.Error == null)    // if there was no error
   {
      ReadOnlyDeviceInfoCollection devices = e.DeviceInfoList;

      // print a list of device names
      foreach (DeviceInfo device in devices)
      {
         Console.WriteLine("Device Name = {0}", device.DeviceName);
      }
   }
   else
   {
      Console.WriteLine(e.Error.ToString()); // print exception
   }
}

See Also

GetAllDevicesInfoAsync
GetAllDevicesInfoCompletedEventArgs Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace

Return to top