I am trying to scan hardware asynchronously but as soon as the first HardwareScan method on RecordingServer gets called all other calls is Idle. I have only one scan in progress and the others are Idle.
Here is the code snippet
private async Task HwScanAsync(MyHardware hardware, UpdateScanHWTasksDelegate updateScanHWTasksDelegate, int taskID)
{
RecordingServer recordingServer = ManagementServer.RecordingServerFolder.RecordingServers.Single(server => server.Name == hardware.RecordingServer);
var scan = recordingServer.HardwareScan(
hardware.Address,
_autoDetectHardware ? null : hardware.HardwareID,
hardware.User,
hardware.Password,
false);
Console.WriteLine("Scaning: " + hardware.Address);
while (scan.State != StateEnum.Error && scan.State != StateEnum.Success)
{
await Task.Delay(3000);
scan.UpdateState();
Console.WriteLine($"Scaning Status for {hardware.Address} is {scan.State}");
}
. . .
Is there a way to run some scans simultaneously, because, with each HardwareScan call, the status is Idle if there is already a running scan?
Basically, I have a list of devices I want to add to the recording servers and I want to run, for example, 5 scans but they are executed one by one…
And another thing, is it possible to cancel/stop running HardwareScan?