Commit 8accf73d authored by Mahmoud Bakhtvar's avatar Mahmoud Bakhtvar

Observable.FromAsync used

parent d38f9bb3
...@@ -26,13 +26,13 @@ namespace C_UI ...@@ -26,13 +26,13 @@ namespace C_UI
var client = new DicomClient(inputsDto.ServerHost, inputsDto.Port, false, inputsDto.ServerAET, inputsDto.Aet); var client = new DicomClient(inputsDto.ServerHost, inputsDto.Port, false, inputsDto.ServerAET, inputsDto.Aet);
client.NegotiateAsyncOps(); client.NegotiateAsyncOps();
inputsDto.FileNames.ToObservable() inputsDto.FileNames.ToObservable()
.Select(fileName => new Task(async () => .Select(fileName => Observable.FromAsync(async () =>
{ {
var request = new DicomCStoreRequest(fileName); var request = new DicomCStoreRequest(fileName);
request.OnResponseReceived += (req, response) => logger.Info($"{response.Status}-{fileName}"); request.OnResponseReceived += (req, response) => logger.Info($"{response.Status}-{fileName}");
await client.AddRequestAsync(request); await client.AddRequestAsync(request);
await client.SendAsync(); await client.SendAsync();
}).ToObservable().Select(x => fileName)) }).Select(x => fileName))
.Concat() .Concat()
.Subscribe( .Subscribe(
filename => filename =>
......
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