BeforeNCreate Event

Summary
Occurs just before an N-CREATE-REQ is sent to the SCP.
Syntax
C#
C++/CLI
public event EventHandler<CommonEventArgs> BeforeNCreate 
public: 
event EventHandler<CommonEventArgs^>^ BeforeNCreate 
Event Data

The event handler receives an argument of type CommonEventArgs containing data related to this event. The following CommonEventArgs properties provide information specific to this event.

PropertyDescription
AffectedClass Gets the affected class.
DataSet Gets the data set.
Instance Gets the instance.
MessageID Gets or sets the message ID.
PresentationID Gets the presentation context id.
Scp (Inherited from Leadtools.Dicom.Scu.Common.BaseEventArgs)Gets the SCP.
Example
C#
using Leadtools.Dicom.Common.DataTypes.Modality; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Scu.Queries; 
using Leadtools.Dicom.Scu; 
using Leadtools.Dicom.Common.Extensions; 
using Leadtools.Dicom.Scu.Common; 
 
 
 
List<ModalityWorklistResult> WorkLists = new List<ModalityWorklistResult>(); 
 
public void PerformMPPS() 
{ 
   DicomEngine.Startup(); 
   DicomNet.Startup(); 
 
   ModalityWorklistQuery query = new ModalityWorklistQuery(); 
   DicomScp scp = new DicomScp(); 
   QueryRetrieveScu findMwl = new QueryRetrieveScu(); 
 
   scp.AETitle = "MWL_SERVER"; 
   scp.Port = 104; 
   scp.Timeout = 60; 
   scp.PeerAddress = IPAddress.Parse("192.168.0.209"); 
   findMwl.AETitle = "LEAD_CLIENT"; 
   findMwl.Find<ModalityWorklistQuery, ModalityWorklistResult>(scp, query, FoundWorklist); 
 
   // 
   // Create a Modality Perform Procedure Step 
   if (WorkLists.Count > 0) 
   { 
      ModalityPerformedProcedureStep mpps = ModalityPerformedProcedureStep.From(WorkLists[0]); 
      PerformedProcedureStepScu pps = new PerformedProcedureStepScu(); 
 
      pps.AETitle = "LEAD_CLIENT"; 
      pps.BeforeNCreate += new EventHandler<CommonEventArgs>(pps_BeforeNCreate); 
      pps.AfterNCreate += new EventHandler<StatusCommonEventArgs>(pps_AfterNCreate); 
      pps.BeforeNSet += new EventHandler<CommonEventArgs>(pps_BeforeNSet); 
      pps.AfterNSet += new EventHandler<StatusCommonEventArgs>(pps_AfterNSet); 
 
      // 
      // Initialize required procedure step variables 
      // 
      mpps.PerformedStationAeTitle = Environment.MachineName; 
      mpps.PerformedProcedureStepStartDate = DateTime.Now; 
      mpps.PerformedProcedureStepStartTime = DateTime.Now; 
      mpps.PerformedSeriesSequence[0].ProtocolName = ModalityPerformedProcedureStep.RandomId(16); 
      mpps.PerformedSeriesSequence[0].SeriesInstanceUID = "1.2.3.4.5.890.1232"; 
      mpps.SOPInstance.SOPInstanceUid = "1.2.3.4.5.890.1240.1"; 
 
      try 
      { 
         pps.Create<ModalityPerformedProcedureStep>(scp, mpps); 
 
         // 
         // Set the procedure step to done 
         // 
         mpps.PerformedProcedureStepEndDate = DateTime.Now; 
         mpps.PerformedProcedureStepEndTime = DateTime.Now; 
         mpps.PerformedProcedureStepStatus = "COMPLETED"; 
         pps.Set<ModalityPerformedProcedureStep>(scp, mpps); 
      } 
      catch (Exception e) 
      { 
         Console.WriteLine(e.Message); 
      } 
   } 
 
   DicomEngine.Shutdown(); 
   DicomNet.Startup(); 
} 
 
private void FoundWorklist(ModalityWorklistResult result, DicomDataSet ds) 
{ 
   WorkLists.Add(result); 
} 
 
void pps_BeforeNCreate(object sender, CommonEventArgs e) 
{ 
   Console.WriteLine("Before N-CREATE-REQ"); 
   Console.WriteLine("\tAffected Class: " + e.AffectedClass); 
   Console.WriteLine("\tInstance: " + e.Instance); 
   Console.WriteLine("\tMessageId: " + e.MessageID.ToString()); 
   Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString()); 
} 
 
void pps_AfterNCreate(object sender, StatusCommonEventArgs e) 
{ 
   Console.WriteLine("After N-CREATE-REQ"); 
   Console.WriteLine("\tAffected Class: " + e.AffectedClass); 
   Console.WriteLine("\tInstance: " + e.Instance); 
   Console.WriteLine("\tMessageId: " + e.MessageID.ToString()); 
   Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString()); 
   Console.WriteLine("\tStatus: " + e.Status.ToString()); 
} 
 
void pps_BeforeNSet(object sender, CommonEventArgs e) 
{ 
   Console.WriteLine("Before N-SET-REQ"); 
   Console.WriteLine("\tAffected Class: " + e.AffectedClass); 
   Console.WriteLine("\tInstance: " + e.Instance); 
   Console.WriteLine("\tMessageId: " + e.MessageID.ToString()); 
   Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString()); 
} 
 
void pps_AfterNSet(object sender, StatusCommonEventArgs e) 
{ 
   Console.WriteLine("After N-CREATE-REQ"); 
   Console.WriteLine("\tAffected Class: " + e.AffectedClass); 
   Console.WriteLine("\tInstance: " + e.Instance); 
   Console.WriteLine("\tMessageId: " + e.MessageID.ToString()); 
   Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString()); 
   Console.WriteLine("\tStatus: " + e.Status.ToString()); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Scu Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.