BeforeCStore Event

Summary
Occurs before a C-STORE-REQ is sent to the server.
Syntax
C#
C++/CLI
public event BeforeCStoreDelegate BeforeCStore 
public: 
event BeforeCStoreDelegate^ BeforeCStore 
Event Data

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

PropertyDescription
AffectedClass Gets the affected class.
Dataset Gets the dataset.
Error Gets the error.
FileInfo Gets the file info.
Instance Gets the instance.
MessageId Gets or sets the message id.
MoveAE Gets the move AE.
MoveMessageID Gets or sets the move message ID.
PresentationID Gets the presentation ID.
Priority Gets the priority.
Scp (Inherited from Leadtools.Dicom.Scu.Common.BaseEventArgs)Gets the SCP.
Skip Gets or sets the skip method.
Example
C#
using Leadtools; 
using Leadtools.Dicom.Scu; 
using Leadtools.Dicom.Scu.Common; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Common.DataTypes; 
using Leadtools.Dicom.Common.DataTypes.Status; 
 
 
 
public void StoreDirectory() 
{ 
   DicomEngine.Startup(); 
   DicomNet.Startup(); 
 
   StoreScu storeDirectory = new StoreScu(); 
   DicomScp scp = new DicomScp(); 
 
   // 
   // Change these parameters to reflect the calling AETitle. 
   // 
 
   storeDirectory.AETitle = "LEAD_CLIENT"; 
   storeDirectory.HostPort = 1000; 
   storeDirectory.HostAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork); 
 
   // 
   // Change these parameters to reflect the called AETitle (server). 
   // 
 
   scp.AETitle = "MI_SERVER"; 
   scp.Port = 104; 
   scp.Timeout = 60; 
   scp.PeerAddress = IPAddress.Parse("10.1.1.96"); 
 
   storeDirectory.BeforeAssociateRequest += new BeforeAssociationRequestDelegate(storeDirectory_BeforeAssociateRequest); 
   storeDirectory.AfterAssociateRequest += new AfterAssociateRequestDelegate(storeDirectory_AfterAssociateRequest); 
   storeDirectory.BeforeCStore += new BeforeCStoreDelegate(storeDirectory_BeforeCStore); 
   storeDirectory.AfterCStore += new AfterCStoreDelegate(storeDirectory_AfterCStore); 
   storeDirectory.Compression = Compression.Native; 
   storeDirectory.Store(scp, LEAD_VARS.ImagesDir + "\\DICOM", "*.*", false); 
 
   DicomNet.Shutdown(); 
   DicomEngine.Shutdown(); 
} 
 
void storeDirectory_BeforeAssociateRequest(object sender, BeforeAssociateRequestEventArgs e) 
{ 
   Console.WriteLine("Before AssociateRequest"); 
} 
 
void storeDirectory_AfterAssociateRequest(object sender, AfterAssociateRequestEventArgs e) 
{ 
   StoreScu scu = sender as StoreScu; 
 
   Console.WriteLine("After AssociateRequest"); 
   for (int i = 0; i < e.Associate.PresentationContextCount; i++) 
   { 
      byte pid = e.Associate.GetPresentationContextID(i); 
      string absSyntax = e.Associate.GetAbstract(pid); 
      DicomAssociateAcceptResultType result = e.Associate.GetResult(pid); 
      DicomUid uid = DicomUidTable.Instance.Find(absSyntax); 
 
      Console.WriteLine("\tPresentationContext ({0})", pid); 
      Console.WriteLine("\t\tAbstractSyntax: {0}", absSyntax); 
      if (uid != null) 
         Console.WriteLine("\t\tDescription: {0}", uid.Name); 
      Console.WriteLine("\t\tResult: {0}", result); 
   } 
} 
 
void storeDirectory_BeforeCStore(object sender, BeforeCStoreEventArgs e) 
{ 
   // 
   // Stop storing if we received an error 
   // 
 
   if (e.Error != null) 
      e.Skip = SkipMethod.AllFiles; 
} 
 
void storeDirectory_AfterCStore(object sender, AfterCStoreEventArgs e) 
{ 
   string msg; 
 
   msg = string.Format("{0} store complete. Status: {1}", e.FileInfo.FullName, e.Status); 
   Console.WriteLine(msg); 
 
   if (e.Status != DicomCommandStatusType.Success) 
   { 
      string statusAllString = e.StatusAll.ToString(StatusFormatFlags.IgnoreStatus, "\n", "\t"); 
      Console.WriteLine(statusAllString); 
   } 
} 
 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

See Also

Reference

StoreScu Class

StoreScu Members

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.