/// <summary>
        /// Creates an instance of <seealso cref="AssociationStatisticsRecorder"/>
        /// </summary>
        /// <param name="network"></param>
        public AssociationStatisticsRecorder(NetworkBase network)
        {
            _logInformation = network.LogInformation;

            // hookup network events
            network.AssociationEstablished += OnAssociationEstablished;
            network.MessageReceived        += OnDicomMessageReceived;
            network.MessageSent            += OnDicomMessageSent;
            network.AssociationReleased    += OnAssociationReleased;

            string description;

            if (network is DicomClient)
            {
                description = string.Format("DICOM association from {0} [{1}:{2}] to {3} [{4}:{5}]",
                                            network.AssociationParams.CallingAE,
                                            network.AssociationParams.LocalEndPoint.Address,
                                            network.AssociationParams.LocalEndPoint.Port,
                                            network.AssociationParams.CalledAE,
                                            network.AssociationParams.RemoteEndPoint.Address,
                                            network.AssociationParams.RemoteEndPoint.Port);
            }
            else
            {
                description = string.Format("DICOM association from {0} [{1}:{2}] to {3} [{4}:{5}]",
                                            network.AssociationParams.CallingAE,
                                            network.AssociationParams.RemoteEndPoint.Address,
                                            network.AssociationParams.RemoteEndPoint.Port,
                                            network.AssociationParams.CalledAE,
                                            network.AssociationParams.LocalEndPoint.Address,
                                            network.AssociationParams.LocalEndPoint.Port);
            }

            _assocStats = new TransmissionStatistics(description);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an instance of <seealso cref="AssociationStatisticsRecorder"/>
        /// </summary>
        /// <param name="network"></param>
        public AssociationStatisticsRecorder(NetworkBase network)
        {
        	_logInformation = network.LogInformation;

            // hookup network events
            network.AssociationEstablished+=OnAssociationEstablished;
            network.MessageReceived += OnDicomMessageReceived;
            network.MessageSent += OnDicomMessageSent;
            network.AssociationReleased+=OnAssociationReleased;

            string description;
            if (network is DicomClient)
                description = string.Format("DICOM association from {0} [{1}:{2}] to {3} [{4}:{5}]",
                                            network.AssociationParams.CallingAE,
                                            network.AssociationParams.LocalEndPoint.Address,
                                            network.AssociationParams.LocalEndPoint.Port,
                                            network.AssociationParams.CalledAE,
                                            network.AssociationParams.RemoteEndPoint.Address,
                                            network.AssociationParams.RemoteEndPoint.Port);
            else
                description = string.Format("DICOM association from {0} [{1}:{2}] to {3} [{4}:{5}]",
                                            network.AssociationParams.CallingAE,
                                            network.AssociationParams.RemoteEndPoint.Address,
                                            network.AssociationParams.RemoteEndPoint.Port,
                                            network.AssociationParams.CalledAE,
                                            network.AssociationParams.LocalEndPoint.Address,
                                            network.AssociationParams.LocalEndPoint.Port);

            _assocStats = new TransmissionStatistics(description);
        }
        /// <summary>
        /// Event handlers called when association has been established.
        /// </summary>
        /// <param name="assoc">The association</param>
        protected void OnAssociationEstablished(AssociationParameters assoc)
        {
            if (_assocStats == null)
            {
                _assocStats = new TransmissionStatistics(string.Format("DICOM association from {0} [{1}:{2}] to {3}",
                                                                       assoc.CallingAE,
                                                                       assoc.RemoteEndPoint.Address,
                                                                       assoc.RemoteEndPoint.Port,
                                                                       assoc.CalledAE));
            }

            // start recording
            _assocStats.Begin();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Event handlers called when association has been established.
 /// </summary>
 /// <param name="assoc">The association</param>
 protected void OnAssociationEstablished(AssociationParameters assoc)
 {
     if (_assocStats == null)
         _assocStats = new TransmissionStatistics(string.Format("DICOM association from {0} [{1}:{2}] to {3}", 
                             assoc.CallingAE, 
                             assoc.RemoteEndPoint.Address, 
                             assoc.RemoteEndPoint.Port,
                             assoc.CalledAE));
               
     // start recording
     _assocStats.Begin(); 
 }