Please help me! When I run project but I receive a error 'CStoreSCP' does not implement interface member 'Dicom.Network.IDicomServiceProvider.OnConnectionClosed(System.Exception)'
class CStoreSCP : DicomService, IDicomServiceProvider, IDicomCStoreProvider, IDicomCEchoProvider
{
private static DicomTransferSyntax[] AcceptedTransferSyntaxes = new DicomTransferSyntax[] {
DicomTransferSyntax.ExplicitVRLittleEndian,
DicomTransferSyntax.ExplicitVRBigEndian,
DicomTransferSyntax.ImplicitVRLittleEndian
};
private static DicomTransferSyntax[] AcceptedImageTransferSyntaxes = new DicomTransferSyntax[] {
// Lossless
DicomTransferSyntax.JPEGLSLossless,
DicomTransferSyntax.JPEG2000Lossless,
DicomTransferSyntax.JPEGProcess14SV1,
DicomTransferSyntax.JPEGProcess14,
DicomTransferSyntax.RLELossless,
// Lossy
DicomTransferSyntax.JPEGLSNearLossless,
DicomTransferSyntax.JPEG2000Lossy,
DicomTransferSyntax.JPEGProcess1,
DicomTransferSyntax.JPEGProcess2_4,
// Uncompressed
DicomTransferSyntax.ExplicitVRLittleEndian,
DicomTransferSyntax.ExplicitVRBigEndian,
DicomTransferSyntax.ImplicitVRLittleEndian
};
public CStoreSCP(Stream stream, Logger log)
: base(stream, log)
{
}
public void OnReceiveAssociationRequest(DicomAssociation association)
{
//if (association.CalledAE != "STORESCP")
if (association.CalledAE != Global.AET)
{
SendAssociationReject(DicomRejectResult.Permanent, DicomRejectSource.ServiceUser, DicomRejectReason.CalledAENotRecognized);
return;
}
foreach (var pc in association.PresentationContexts)
{
if (pc.AbstractSyntax == DicomUID.Verification)
pc.AcceptTransferSyntaxes(AcceptedTransferSyntaxes);
else if (pc.AbstractSyntax.StorageCategory != DicomStorageCategory.None)
pc.AcceptTransferSyntaxes(AcceptedImageTransferSyntaxes);
}
SendAssociationAccept(association);
}
public void OnReceiveAssociationReleaseRequest()
{
SendAssociationReleaseResponse();
}
public void OnReceiveAbort(DicomAbortSource source, DicomAbortReason reason)
{
}
public void OnConnectionClosed(int errorCode)
{
}
public DicomCStoreResponse OnCStoreRequest(DicomCStoreRequest request)
{
bool lReturn = true;
//if (!string.IsNullOrEmpty(hidUD))
// if (!ud.KiemTraCamUSB(true))
// lReturn = false;
if (lReturn)
{
var studyUid = request.Dataset.Get<string>(DicomTag.StudyInstanceUID);
var instUid = request.SOPInstanceUID.UID;
var path = Path.GetFullPath(PathSource.Replace("..", Application.StartupPath));
path = Path.Combine(path, studyUid);
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
path = Path.Combine(path, instUid) + ".dcm";
request.File.Save(path);
try
{
Bitmap bmp;
var image = new DicomImage(path);
bmp = new Bitmap(image.RenderImage());
bmp = CatHinh(bmp);
Dicom.DicomDataset ds = image.Dataset;
var tag = DicomTag.Parse("0010,0010");
var value = image.Dataset.Get<string>(tag);
var pcName = ds.Get<string>(DicomTag.Parse("0010,0010"));
var pcID = ds.Get<string>(DicomTag.Parse("0010,0020"));
var pcInstance = ds.Get<string>(DicomTag.Parse("0020,0013"));
string pcFolderParent = "", pcFolder = "";
if (Global.Option == "1")
{
pcFolderParent = PathSave + @"\Nam" + DateTime.Now.ToString("yyyy") + @"\Thang" + DateTime.Now.ToString("MM") + @"\Ngay" + DateTime.Now.ToString("dd");
pcFolder = pcFolderParent + @"\" + pcName + "-" + pcID;
}
if (Global.Option == "2")
{
pcFolderParent = PathSave + @"\" + DateTime.Now.ToString("yyyy") + DateTime.Now.ToString("MM") + DateTime.Now.ToString("dd");
pcFolder = pcFolderParent + @"\" + pcName + "-" + pcID;
}
if (Global.Option == "3")
{
pcFolderParent = PathSave;
pcFolder = pcFolderParent + @"\" + pcName + "-" + pcID;
}
if (!Directory.Exists(pcFolderParent))
Directory.CreateDirectory(pcFolderParent);
if (!Directory.Exists(pcFolder))
{
iStt = 0;
Directory.CreateDirectory(pcFolder);
}
iStt++;
string pcNameFile = pcFolder + @"\" + iStt.ToString().PadLeft(2,'0') + ".jpg";
bmp.Save(pcNameFile);
}
catch (Exception ex)
{
}
}
return new DicomCStoreResponse(request, DicomStatus.Success);
}
public void OnCStoreRequestException(string tempFileName, Exception e)
{
// let library handle logging and error response
}
public DicomCEchoResponse OnCEchoRequest(DicomCEchoRequest request)
{
return new DicomCEchoResponse(request, DicomStatus.Success);
}
}