Commit d38f9bb3 authored by Mahmoud Bakhtvar's avatar Mahmoud Bakhtvar

using new Task(async) to serialize Send

parent cc9cc376
......@@ -26,23 +26,20 @@ namespace C_UI
var client = new DicomClient(inputsDto.ServerHost, inputsDto.Port, false, inputsDto.ServerAET, inputsDto.Aet);
client.NegotiateAsyncOps();
inputsDto.FileNames.ToObservable()
.Select(async fileName =>
.Select(fileName => new Task(async () =>
{
var request = new DicomCStoreRequest(fileName);
request.OnResponseReceived += (req, response) => logger.Info($"{response.Status}-{fileName}");
await client.AddRequestAsync(request);
await client.SendAsync();
})
.Select(
t => t.Exception.Flatten()
)
}).ToObservable().Select(x => fileName))
.Concat()
.Subscribe(
filename =>
logger.Warn($"file sent:{filename}"),
onError =>
logger.Error(onError.Message ),
() => { }
);
logger.Error(onError.Message),
() => { });
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment