Example #1
0
        //
        // - Methods -
        //
        protected override void ProcessTrigger(Object trigger)
        {
            if (trigger is SendAssociationTrigger)
            {
                SendAssociationTrigger sendAssociationTrigger = trigger as SendAssociationTrigger;

                try
                {
                    sendAssociationTrigger.returnValue = SendAssociation(sendAssociationTrigger.dicomMessageCollection, sendAssociationTrigger.presentationContexts);
                }
                catch (DicomProtocolMessageReceiveException)
                {
                    // Console.WriteLine("DicomProtocolMessageReceiveException: {0} - {1}", exception.Message, exception.ReceiveReturnCode);
                    sendAssociationTrigger.returnValue = false;
                }
                catch (DicomProtocolMessageSendException)
                {
                    // Console.WriteLine("DicomProtocolMessageSendException: {0} - {1}", exception.Message, exception.SendReturnCode);
                    sendAssociationTrigger.returnValue = false;
                }
                catch (Exception)
                {
                    // Console.WriteLine("Exception: {0}", exception.Message);
                    sendAssociationTrigger.returnValue = false;
                }
            }
        }
Example #2
0
File: SCU.cs Project: ewcasas/DVTK
        /// <summary>
        /// Triggers sending of an association.
        /// </summary>
        /// <param name="dicomMessage">The DICOM message to send.</param>
        /// <param name="presentationContexts">The presentation contexts to use for setting up the DICOM association.</param>
        public void TriggerSendAssociation(DicomMessage dicomMessage, params PresentationContext[] presentationContexts)
        {
            DicomMessageCollection dicomMessageCollection = new DicomMessageCollection();
            dicomMessageCollection.Add(dicomMessage);

            SendAssociationTrigger sendAssociationTrigger = new SendAssociationTrigger(dicomMessageCollection, presentationContexts);

            Trigger(sendAssociationTrigger);
        }
Example #3
0
File: SCU.cs Project: top501/DVTK-1
        /// <summary>
        /// Triggers sending of an association.
        /// </summary>
        /// <param name="dicomMessage">The DICOM message to send.</param>
        /// <param name="presentationContexts">The presentation contexts to use for setting up the DICOM association.</param>
        public void TriggerSendAssociation(DicomMessage dicomMessage, params PresentationContext[] presentationContexts)
        {
            DicomMessageCollection dicomMessageCollection = new DicomMessageCollection();

            dicomMessageCollection.Add(dicomMessage);

            SendAssociationTrigger sendAssociationTrigger = new SendAssociationTrigger(dicomMessageCollection, presentationContexts);

            Trigger(sendAssociationTrigger);
        }
Example #4
0
File: SCU.cs Project: top501/DVTK-1
        /// <summary>
        /// Trigger a send association and wait until it has been completed.
        /// </summary>
        /// <param name="dicomMessageCollection">The DICOM messages to send.</param>
        /// <param name="presentationContexts">The presentation contexts to propose.</param>
        /// <returns>
        /// True indicates the other side has accepted the association, false indicates the other side
        /// has rejected the association.
        /// </returns>
        public bool TriggerSendAssociationAndWait(DicomMessageCollection dicomMessageCollection, params PresentationContext[] presentationContexts)
        {
            SendAssociationTrigger sendAssociationTrigger = new SendAssociationTrigger(dicomMessageCollection, presentationContexts);

            Trigger(sendAssociationTrigger);

            WaitForLastTriggerCallProcessed();

            return(sendAssociationTrigger.returnValue);
        }
Example #5
0
        /// <summary>
        /// May be overriden to implement things that need to be performed after
        /// processing a trigger.
        /// </summary>
        /// <param name="trigger">The trigger that will be processed.</param>
        public override void AfterProcessTrigger(Object trigger)
        {
            // set the process trigger result
            if (trigger is SendAssociationTrigger)
            {
                SendAssociationTrigger sendAssociationTrigger = trigger as SendAssociationTrigger;
                _processTriggerResult = sendAssociationTrigger.returnValue;
            }

            // call the base implementation
            base.AfterProcessTrigger(trigger);
        }
Example #6
0
File: SCU.cs Project: ewcasas/DVTK
        /// <summary>
        /// Trigger a send association and wait until it has been completed.
        /// </summary>
        /// <param name="dicomMessage">The DICOM message to send.</param>
        /// <param name="presentationContexts">The presentation contexts to propose.</param>
        /// <returns>
        /// True indicates the other side has accepted the association, false indicates the other side
        /// has rejected the association.
        /// </returns>
        public bool TriggerSendAssociationAndWait(DicomMessage dicomMessage, params PresentationContext[] presentationContexts)
        {
            DicomMessageCollection dicomMessageCollection = new DicomMessageCollection();
            dicomMessageCollection.Add(dicomMessage);

            SendAssociationTrigger sendAssociationTrigger = new SendAssociationTrigger(dicomMessageCollection, presentationContexts);

            Trigger(sendAssociationTrigger);

            WaitForLastTriggerCallProcessed();

            return(sendAssociationTrigger.returnValue);
        }
Example #7
0
File: SCU.cs Project: top501/DVTK-1
        //
        // - Methods -
        //

        /// <summary>
        /// Processed a trigger.
        /// </summary>
        /// <param name="trigger">The trigger.</param>
        protected override void ProcessTrigger(Object trigger)
        {
            if (trigger is SendAssociationTrigger)
            {
                SendAssociationTrigger sendAssociationTrigger = trigger as SendAssociationTrigger;

                try
                {
                    sendAssociationTrigger.returnValue = SendAssociation(sendAssociationTrigger.dicomMessageCollection, sendAssociationTrigger.presentationContexts);
                }
                catch (Exception exception)
                {
                    sendAssociationTrigger.returnValue = false;
                    throw(exception);
                }
            }
            else
            {
                // Do nothing.
            }
        }
Example #8
0
        //
        // - Methods -
        //
        protected override void ProcessTrigger(Object trigger)
        {
            if (trigger is SendAssociationTrigger)
            {
                SendAssociationTrigger sendAssociationTrigger = trigger as SendAssociationTrigger;

                try
                {
                    sendAssociationTrigger.returnValue = SendAssociationAndWait(sendAssociationTrigger.dicomMessageCollection, sendAssociationTrigger.presentationContexts);
                }
                catch (Exception exception)
                {
                    System.String message = "ProcessTrigger failure - unknown reason.";

                    // If no messages have been sent then assume a connection problem
                    if (Messages.Count == 0)
                    {
                        message = "Connection failure - message cannot be sent.";
                    }
                    else
                    {
                        foreach (DulMessage dulMessage in Messages.DulMessages)
                        {
                            if (dulMessage.IsAbort == true)
                            {
                                // Found ABORT message - reason for failure?
                                message = "DULP ABORT-RQ received.";
                                break;
                            }
                        }
                    }

                    Exception newException = new Exception(message, exception);

                    sendAssociationTrigger.returnValue = false;

                    //throw newException;
                }
            }
        }