Commit 1c1fd957 authored by Mahmoud Bakhtvar's avatar Mahmoud Bakhtvar

t.Wait() added to wait for finishing sending each file

parent 710248a5
...@@ -27,15 +27,20 @@ namespace C_UI ...@@ -27,15 +27,20 @@ namespace C_UI
client.NegotiateAsyncOps(); client.NegotiateAsyncOps();
dicomFiles.ToObservable() dicomFiles.ToObservable()
.Select(async onNext => .Select(async fileName =>
{ {
var request = new DicomCStoreRequest(fileName);
var request = new DicomCStoreRequest(onNext); request.OnResponseReceived += (req, response) => logger.Info($"{response.Status}-{fileName}");
request.OnResponseReceived += (req, response) => logger.Info($"{response.Status}-{onNext}");
await client.AddRequestAsync(request); await client.AddRequestAsync(request);
await client.SendAsync(); await client.SendAsync();
return fileName;
})
.Select(t =>
{
t.Wait();
return t.Result;
}) })
.Subscribe(x => { }, onError => logger.Error(onError.Message), () => { }); .Subscribe(filename => logger.Warn($"file sent:{filename}"), onError => 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