Esempio n. 1
0
        /// <summary>
        /// Constructor with initialization. Shallow copy.
        /// </summary>
        /// <param name="arrayOfValues">values to copy.</param>
        public DulMessageCollection(DulMessage[] arrayOfValues)
        {
            if (arrayOfValues == null)
            {
                throw new ArgumentNullException();
            }

            foreach (DulMessage value in arrayOfValues)
            {
                this.Add(value);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This method is indirectly called by a MessageIterator to let this object try
        /// to handle the received DulMessage.
        /// </summary>
        /// <param name="dulMessage">The received DulMessage.</param>
        /// <returns>Returns true if this object has handled the DulMessage, otherwise false.</returns>
        private bool HandleDulMessage(DulMessage dulMessage)
        {
            bool handled = false;

            if (dulMessage is Abort)
            {
                handled = HandleAbort(dulMessage as Abort);
            }
            else if (dulMessage is AssociateAc)
            {
                handled = HandleAssociateAccept(dulMessage as AssociateAc);
            }
            else if (dulMessage is AssociateRj)
            {
                handled = HandleAssociateReject(dulMessage as AssociateRj);
            }
            else if (dulMessage is AssociateRq)
            {
                handled = HandleAssociateRequest(dulMessage as AssociateRq);
            }
            else if (dulMessage is ReleaseRp)
            {
                handled = HandleReleaseResponse(dulMessage as ReleaseRp);
            }
            else if (dulMessage is ReleaseRq)
            {
                handled = HandleReleaseRequest(dulMessage as ReleaseRq);
            }
            else
            {
                Debug.Assert(true, "Not implemented yet.");
            }

            return(handled);
        }
Esempio n. 3
0
 /// <summary>
 /// This method is called after a DulMessage has been received but before it
 /// (possibly) will be handled by the (zero or more) MessageHandler objects that
 /// are attached to this object.
 /// </summary>
 /// <param name="dulMessage">The received DulMessage.</param>
 private void BeforeHandlingDulMessage(DulMessage dulMessage)
 {
     if (dulMessage is Abort)
     {
         BeforeHandlingAbort(dulMessage as Abort);
     }
     else if (dulMessage is AssociateAc)
     {
         BeforeHandlingAssociateAccept(dulMessage as AssociateAc);
     }
     else if (dulMessage is AssociateRj)
     {
         BeforeHandlingAssociateReject(dulMessage as AssociateRj);
     }
     else if (dulMessage is AssociateRq)
     {
         BeforeHandlingAssociateRequest(dulMessage as AssociateRq);
     }
     else if (dulMessage is ReleaseRq)
     {
         BeforeHandlingReleaseRequest(dulMessage as ReleaseRq);
     }
     else if (dulMessage is ReleaseRp)
     {
         BeforeHandlingReleaseResponse(dulMessage as ReleaseRp);
     }
     else
     {
         Debug.Assert(true, "Not implemented yet.");
     }
 }
Esempio n. 4
0
        //
        // - Methods -
        //

        /// <summary>
        /// Adds an item to the <see cref="System.Collections.IList"/>.
        /// </summary>
        /// <param name="value">The item to add to the <see cref="System.Collections.IList"/>. </param>
        /// <returns>The position into which the new element was inserted.</returns>
        public int Add(DulMessage value)
        {
            return(base.Add(value));
        }
Esempio n. 5
0
 /// <summary>
 /// Removes the first occurrence of a specific item from the IList.
 /// </summary>
 /// <param name="value">The item to remove from the <see cref="System.Collections.IList"/>.</param>
 public void Remove(DulMessage value)
 {
     base.Remove(value);
 }
Esempio n. 6
0
 /// <summary>
 /// Inserts an item to the IList at the specified position.
 /// </summary>
 /// <param name="index">The zero-based index at which <c>value</c> should be inserted. </param>
 /// <param name="value">The item to insert into the <see cref="System.Collections.IList"/>.</param>
 public void Insert(int index, DulMessage value)
 {
     base.Insert(index, value);
 }
Esempio n. 7
0
 /// <summary>
 /// Determines the index of a specific item in the <see cref="System.Collections.IList"/>.
 /// </summary>
 /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param>
 /// <returns>The index of <c>value</c> if found in the list; otherwise, -1.</returns>
 public int IndexOf(DulMessage value)
 {
     return(base.IndexOf(value));
 }
Esempio n. 8
0
 /// <summary>
 /// Determines whether the <see cref="System.Collections.IList"/> contains a specific item.
 /// </summary>
 /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param>
 /// <returns><see langword="true"/> if the item is found in the <see cref="System.Collections.IList"/>; otherwise, <see langword="false"/>.</returns>
 public bool Contains(DulMessage value)
 {
     return(base.Contains(value));
 }
Esempio n. 9
0
        /// <summary>
        /// Validates a Dul Message.
        /// </summary>
        /// <param name="dulMessage">The Dul Message to validate.</param>
        public void Validate(DulMessage dulMessage)
        {
            WriteInformation("Validate Dul message...");

            this.dvtkScriptSession.Validate(dulMessage.DvtkDataDulMessage, null, Dvtk.Sessions.ValidationControlFlags.UseValueRepresentations);
        }
Esempio n. 10
0
        private void SendMessage(DulMessage dulMessage)
        {
            //
            // Administration.
            //

            dulMessage.IsSend = true;

            AddMessage(dulMessage);

            if (SendingMessageEvent != null)
            {
                SendingMessageEvent(dulMessage);
            }

            //
            // Perform the actual sending.
            //

            Dvtk.Sessions.SendReturnCode sendReturnCode = Dvtk.Sessions.SendReturnCode.Failure;

            sendReturnCode = DvtkScriptSession.Send(dulMessage.DvtkDataDulMessage);

            //
            // If an error is encountered while sending, throw an exception.
            //

            if (sendReturnCode != Dvtk.Sessions.SendReturnCode.Success)
            {
                throw new DicomProtocolMessageSendException("Error while trying to send a " + dulMessage.ToString() + " (" + sendReturnCode.ToString() + ")", sendReturnCode);
            }

            if (dulMessage is AssociateAc)
            {
                this.lastAssociateAc = dulMessage as AssociateAc;
            }
        }
Esempio n. 11
0
 //
 // - Methods -
 //
 /// <summary>
 /// Adds an item to the <see cref="System.Collections.IList"/>.
 /// </summary>
 /// <param name="value">The item to add to the <see cref="System.Collections.IList"/>. </param>
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(DulMessage value)
 {
     return base.Add(value);
 }
Esempio n. 12
0
 /// <summary>
 /// Removes the first occurrence of a specific item from the IList.
 /// </summary>
 /// <param name="value">The item to remove from the <see cref="System.Collections.IList"/>.</param>
 public void Remove(DulMessage value)
 {
     base.Remove(value);
 }
Esempio n. 13
0
 /// <summary>
 /// Inserts an item to the IList at the specified position.
 /// </summary>
 /// <param name="index">The zero-based index at which <c>value</c> should be inserted. </param>
 /// <param name="value">The item to insert into the <see cref="System.Collections.IList"/>.</param>
 public void Insert(int index, DulMessage value)
 {
     base.Insert(index, value);
 }
Esempio n. 14
0
 /// <summary>
 /// Determines the index of a specific item in the <see cref="System.Collections.IList"/>.
 /// </summary>
 /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param>
 /// <returns>The index of <c>value</c> if found in the list; otherwise, -1.</returns>
 public int IndexOf(DulMessage value)
 {
     return base.IndexOf(value);
 }
Esempio n. 15
0
 /// <summary>
 /// Determines whether the <see cref="System.Collections.IList"/> contains a specific item.
 /// </summary>
 /// <param name="value">The item to locate in the <see cref="System.Collections.IList"/>.</param>
 /// <returns><see langword="true"/> if the item is found in the <see cref="System.Collections.IList"/>; otherwise, <see langword="false"/>.</returns>
 public bool Contains(DulMessage value)
 {
     return base.Contains(value);
 }