SendCFindResponse Example for C#
//This example uses the predefined variable “TreeView1” of
type “TreeView” from “.NET Framework”.
//LEADDICOMNet1 is a predefined LEADDicomNet object
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void LEADDICOMNet1_NetReceiveCFindRequest(int hNet, short nPresentationID,
short nMessageID, string pszClass, short nPriority, int hDS)
{
int x = 0;
int hPDU = 0;
string szAE = null;
System.Windows.Forms.TreeNode NewNode = null;
short nRet = 0;
string szName = null;
string szFile = null;
string szReply = null;
//this sample simple returns all the data sets that it is managing.
//in a real-life scenario, this should perform an actual query based
//on the attribute values supplied in hDS
hPDU = LEADDICOMNet1.GetAssociate(hNet);
szAE = LEADDICOMNet1.GetCalling(hPDU);
NewNode = new System.Windows.Forms.TreeNode("Command Set - "
+ "C-FIND-REQUEST");
TreeView1.Nodes.Add(NewNode);
NewNode.EnsureVisible();
NewNode.Nodes.Add("Presentation ID: " + System.Convert.ToString(nPresentationID));
NewNode.Nodes.Add("Message ID: " + System.Convert.ToString(nMessageID));
nRet = LEADDICOM1.FindUID(pszClass);
if (nRet == 0)
{
szName = LEADDICOM1.get_CurrentUID().Name;
NewNode.Nodes.Add("Affected SOP Class: " + szName + " -
" + pszClass);
}
else
NewNode.Nodes.Add("Affected SOP Class: " + pszClass);
NewNode.Nodes.Add("Priority: " + System.Convert.ToString(nPriority));
//load sample file 1
nRet = LEADDICOM1.LoadDS("e:\\images\\dicom16.dic",
0);
if (nRet == 0)
{
LEADDICOMNet1.SendCFindResponse(hNet,
nPresentationID, nMessageID, pszClass, (int)LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_PENDING,
LEADDICOM1.hDicomDS);
}
//send a Find Response - PENDING
nRet = LEADDICOM1.LoadDS("e:\\images\\test.dic", 0);
if (nRet == 0)
{
LEADDICOMNet1.SendCFindResponse(hNet,
nPresentationID, nMessageID, pszClass, (int)LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_PENDING,
LEADDICOM1.hDicomDS);
}
//now, send a Find Response - SUCCESS
LEADDICOMNet1.SendCFindResponse(hNet,
nPresentationID, nMessageID, pszClass, (int)LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_SUCCESS,
0);
}