SendNActionRequest Example for C#

//LEADDICOMNet1 is a predefined LEADDicomNet object
//LEADDICOM1 is a DICOM Dataset defined outside this method
private void TestSendNActionRequest ( )
{
   //this sample shows how to send an N-ACTION-REQUEST
   const string UID_BASIC_FILM_BOX_CLASS = "1.2.840.10008.5.1.1.2";
   // Basic Film Box SOP Class
   short nRet = 0;
   string szClassUID = null;
   string szInstance = null;
   int hPDU = 0;
   short nID = 0;
   short nAction = 0;
   //send an N-ACTION-REQUEST to the server
   nAction = 1 ;
   szClassUID = UID_BASIC_FILM_BOX_CLASS ;
   szInstance = "1.1.1.1" ;
   //here you would create a data set that encodes the Action Arguments
   //for this example, we just load a dataset
   //... nRet = LEADDICOM1.LoadDS("e:\\images\\dicom16.dic", 0);
   hPDU = LEADDICOMNet1.GetAssociate(LEADDICOMNet1.hNet);
   //now, send a request
   nID = LEADDICOMNet1.FindPresentationAbstract(hPDU, szClassUID);
   if (nID == 0)
   {
      nRet = LEADDICOM1.FindUID(szClassUID);
      if (nRet == 0)
         MessageBox.Show("Abstract Syntax, " + LEADDICOM1.get_CurrentUID().Name + ", Not Supported by Association!");
      else
         MessageBox.Show("Abstract Syntax, " + szClassUID + ", Not Supported by Association!");
      return;
   }
   LEADDICOMNet1.SendNActionRequest(LEADDICOMNet1.hNet, nID, 1, szClassUID, szInstance, nAction, LEADDICOM1.hDicomDS);
}