ReportOperationCompletedEventArgs Constructor (String, Exception)
Initializes an instance of the ReportOperationCompletedEventArgs class that has the specified device identifier and the specified exception.
Namespace: Microsoft.WindowsServerSolutions.Common.Devices
Assembly: DevicesOM (in DevicesOM.dll)
Syntax
public ReportOperationCompletedEventArgs(
string deviceId,
Exception error
)
public:
ReportOperationCompletedEventArgs(
String^ deviceId,
Exception^ error
)
Public Sub New (
deviceId As String,
error As Exception
)
Parameters
deviceId
Type: System.StringThe identifier of the device to be reported.
error
Type: System.ExceptionThe exception that is thrown.
Examples
The following code example shows how to initialize a new instance of ReportOperationCompletedEventArgs.
DevicesManager dm = new DevicesManager();
dm.Connect();
string deviceId = Guid.NewGuid().ToString();
Guid deviceType = DeviceTypes.Client;
string deviceName = "SDK Device";
DeviceIdentityStatus status = DeviceIdentityStatus.Active;
string additionalInfo = null;
dm.ReportDeviceCompleted +=
new EventHandler<ReportOperationCompletedEventArgs>(
dm_ReportDeviceCompleted);
dm.ReportDeviceAsync(deviceId,
deviceType,
deviceName,
status,
additionalInfo);
The following code example shows how to implement the delegate method.
static void dm_ReportDeviceCompleted(object sender,
ReportOperationCompletedEventArgs e)
{
if (e.Error == null)
{
Console.WriteLine("Successfully reported device {0}", e.DeviceId);
}
else
{
Console.WriteLine(e.Error.ToString());
}
}
See Also
ReportOperationCompletedEventArgs Class
Microsoft.WindowsServerSolutions.Common.Devices Namespace
Return to top