NetReceiveNSetRequest 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_NetReceiveNSetRequest(int
hNet, short nPresentationID, short nMessageID, string pszClass, string
pszInstance, int hDS)
{
short nRet = 0;
System.Windows.Forms.TreeNode NewNode = null;
string szReply = null;
string szName = null;
NewNode = new System.Windows.Forms.TreeNode("Command Set - "
+ "N-SET-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("Affected SOP Instance: " + pszInstance);
//this function will change the values of the requested SOP Instance
//to the values specefied in the data set elements in hDS
//this function should search all the managed SOP Instances for a
//match, and then change the requested elements.
//This is a function you must write
//nRet = PerformNSETCommand(pszClass, pszInstance, hDS)
if (nRet != (short)LTDicomKernelLib.DicomErrorCodes.DICOM_SUCCESS)
nRet = (short)LTDNCLib.DicomCommandStatusConstants.COMMAND_STATUS_NO_SUCH_OBJECT_INSTANCE;
//send a response
LEADDICOMNet1.SendNSetResponse(hNet, nPresentationID, nMessageID, pszClass,
pszInstance, nRet, 0);
}