/// <summary> /// Create and start a sub DicomThread. /// </summary> /// <param name="overviewThread">The overview Thread.</param> internal void CreateAndStartChildDicomThread(ConcurrentSCP overviewThread) { // Create a new sub DicomThread. Type[] types = new Type[0]; ConstructorInfo constructorInfo = overviewThread.GetType().GetConstructor(types); ConcurrentSCP subDicomThread = constructorInfo.Invoke(null) as ConcurrentSCP; // The new sub threads must become a child of the overview Thread. subDicomThread.Initialize(overviewThread); subDicomThread.overviewThread = overviewThread; // Copy all options from the overview Thread. subDicomThread.Options.DeepCopyFrom(overviewThread.Options); // Set the correct identifier for the new sub thread. lock (this.lockObject) { subDicomThread.Options.Identifier = overviewThread.Options.Identifier + "_SubDicomThread" + overviewThread.subDicomThreadNumber.ToString(); overviewThread.subDicomThreadNumber++; } // Copy all handlers from the overview Thread. foreach (MessageHandler messageHandler in overviewThread.MessagesHandlers) { subDicomThread.AddToFront(messageHandler); } subDicomThread.AssociationReleasedEvent += new AssociationReleasedEventHandler(HandleChildAssociationReleasedEvent); // Start the new sub DicomThread. subDicomThread.Start(); }
/// <summary> /// Constructor. /// /// Only use within this class to create a sub DicomThread that handles one association. /// </summary> /// <param name="overviewThread">The overview thread that contains the sub DicomThreads.</param> public ConcurrentSCP(ConcurrentSCP overviewThread) { this.overviewThread = overviewThread; }
/// <summary> /// Create and start a sub DicomThread. /// </summary> /// <param name="overviewThread">The overview Thread.</param> internal void CreateAndStartChildDicomThread(ConcurrentSCP overviewThread) { // Create a new sub DicomThread. Type[] types = new Type[0]; ConstructorInfo constructorInfo = overviewThread.GetType().GetConstructor(types); ConcurrentSCP subDicomThread = constructorInfo.Invoke(null) as ConcurrentSCP; // The new sub threads must become a child of the overview Thread. subDicomThread.Initialize(overviewThread); subDicomThread.overviewThread = overviewThread; // Copy all options from the overview Thread. subDicomThread.Options.DeepCopyFrom(overviewThread.Options); // Set the correct identifier for the new sub thread. lock(this.lockObject) { subDicomThread.Options.Identifier = overviewThread.Options.Identifier + "_SubDicomThread" + overviewThread.subDicomThreadNumber.ToString(); overviewThread.subDicomThreadNumber++; } // Copy all handlers from the overview Thread. foreach(MessageHandler messageHandler in overviewThread.MessagesHandlers) { subDicomThread.AddToFront(messageHandler); } subDicomThread.AssociationReleasedEvent+= new AssociationReleasedEventHandler(HandleChildAssociationReleasedEvent); // Start the new sub DicomThread. subDicomThread.Start(); }