Example #1
0
 protected override void OnReceiveCStoreResponse(byte presentationID, ushort messageIdRespondedTo, DicomUID affectedInstance, DcmStatus status)
 {
     _current.Status = status;
     if (OnCStoreResponseReceived != null)
     {
         try
         {
             OnCStoreResponseReceived(this, _current);
         }
         catch (Exception e)
         {
             Log.Error("Unhandled exception in user C-Store Response Callback: {0}", e.ToString());
         }
     }
     _current.Unload();
     _current = null;
     SendNextCStoreRequest();
 }
Example #2
0
        protected override void OnConnectionClosed()
        {
            if (_current != null)
            {
                _current.Reset();
                AddFile(_current);
                _current = null;
            }

            if (!ClosedOnError && !_cancel)
            {
                if (PendingCount > 0)
                {
                    Reconnect();
                    return;
                }

                if (OnCStoreComplete != null)
                {
                    try
                    {
                        OnCStoreComplete(this);
                    }
                    catch (Exception e)
                    {
                        Log.Error("Unhandled exception in user C-Store Complete Callback: {0}", e.Message);
                    }
                }
            }

            if (OnCStoreClosed != null)
            {
                try
                {
                    OnCStoreClosed(this);
                }
                catch (Exception e)
                {
                    Log.Error("Unhandled exception in user C-Store Closed Callback: {0}", e.Message);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Enqueues a file to be transfered to the remote DICOM node.
        /// </summary>
        /// <param name="info">C-Store Request Information</param>
        public void AddFile(CStoreRequestInfo info)
        {
            if (info.HasError)
            {
                return;
            }

            lock (_lock) {
                _sendQueue.Enqueue(info);
                if (!_presContextMap.ContainsKey(info.SOPClassUID))
                {
                    _presContextMap.Add(info.SOPClassUID, new List <DicomTransferSyntax>());
                }
                if (!_presContextMap[info.SOPClassUID].Contains(info.TransferSyntax))
                {
                    _presContextMap[info.SOPClassUID].Add(info.TransferSyntax);
                }
            }

            if (Linger > 0 && IsClosed && CanReconnect && !ClosedOnError)
            {
                Reconnect();
            }
        }