Commit 9ed82e73 authored by alan.f's avatar alan.f

change-inputs-to-model

parent 1c1fd957
......@@ -73,6 +73,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Models\InputsDto.cs" />
<Compile Include="SCU_Store.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
......
using System;
using C_UI.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
......@@ -25,7 +26,10 @@ namespace C_UI
string fileExt = System.IO.Path.GetExtension(ofdUploadFile.FileName);
if (result == DialogResult.OK && fileExt==".dcm")
{
SCU_Store.StoreFile(cbxIPs.Text, int.Parse(txtPort.Text), ofdUploadFile.FileNames, txtServerAET.Text, txtAet.Text);
InputsDto inputsDto = new InputsDto() { ServerHost= cbxIPs.Text ,Port= int.Parse(txtPort.Text) ,
FileNames= ofdUploadFile.FileNames ,ServerAET= txtServerAET.Text,Aet = txtAet.Text
};
SCU_Store.StoreFile(inputsDto);
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace C_UI.Models
{
public struct InputsDto
{
public string ServerHost { get; set; }
public int Port { get; set; }
public string[] FileNames { get; set; }
public string ServerAET { get; set; }
public string Aet { get; set; }
}
}
......@@ -12,6 +12,7 @@ using System.Windows.Forms;
using DicomClient = Dicom.Network.Client.DicomClient;
using System.Reactive.Threading.Tasks;
using System.CodeDom;
using C_UI.Models;
namespace C_UI
{
......@@ -20,13 +21,12 @@ namespace C_UI
{
static Logger logger = LogManager.GetCurrentClassLogger();
public static async Task StoreFile(string _storeServerHost, int _storeServerPort, string[] dicomFiles
, string _aet, string _storeServerAET)
public static async Task StoreFile(InputsDto inputsDto)
{
var client = new DicomClient(_storeServerHost, _storeServerPort, false, _storeServerAET, _aet);
var client = new DicomClient(inputsDto.ServerHost, inputsDto.Port, false, inputsDto.ServerAET, inputsDto.Aet);
client.NegotiateAsyncOps();
dicomFiles.ToObservable()
inputsDto.FileNames.ToObservable()
.Select(async fileName =>
{
var request = new DicomCStoreRequest(fileName);
......@@ -37,10 +37,15 @@ namespace C_UI
})
.Select(t =>
{
t.Wait();
return t.Result;
})
.Subscribe(filename => logger.Warn($"file sent:{filename}"), onError => logger.Error(onError.Message), () => { });
}).Subscribe();
//.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