DevicesManager.GetAllDevicesInfoAsync Method ()
Asynchronously gets the information for all of the devices.
Namespace: Microsoft.WindowsServerSolutions.Common.Devices
Assembly: DevicesOM (in DevicesOM.dll)
Syntax
public void GetAllDevicesInfoAsync()
public:
void GetAllDevicesInfoAsync()
Public Sub GetAllDevicesInfoAsync
Remarks
The caller of this method should subscribe to the GetAllDevicesInfoCompleted event to get the return value. GetAllDevicesInfoCompletedEventArgs.Error should also be checked to know whether an error occurred with the operation.
Examples
The following code example shows how to asynchronously retrieve a collection of DeviceInfo objects.
DevicesManager dm = new DevicesManager();
dm.Connect();
dm.GetAllDevicesInfoCompleted +=
new EventHandler<GetAllDevicesInfoCompletedEventArgs>(
dm_GetAllDevicesInfoCompleted);
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());
}
}
See Also
DevicesManager Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace
Return to top