Example #1
0
        /// <summary>
        /// Stop the Actor.
        /// </summary>
        public void StopActor()
        {
            switch (_actorState)
            {
                case ActorStateEnum.ActorStarted:
                {
                    ICollection hl7Servers = _hl7Servers.Values;
                    foreach (Hl7Server hl7Server in hl7Servers)
                    {
                        hl7Server.StopServer();
                    }

                    ICollection hl7Clients = _hl7Clients.Values;
                    foreach (Hl7Client hl7Client in hl7Clients)
                    {
                        hl7Client.StopClient();
                    }

                    ICollection dicomServers = _dicomServers.Values;
                    foreach (DicomServer dicomServer in dicomServers)
                    {
                        dicomServer.StopServer();
                    }

                    ICollection dicomClients = _dicomClients.Values;
                    foreach (DicomClient dicomClient in dicomClients)
                    {
                        dicomClient.StopClient();
                    }

                    _threadManager.WaitForCompletionThreads();
                    _actorState = ActorStateEnum.ActorStopped;
                    _defaultValueManager = null;
                    break;
                }
                default:
                    // actor either not configured or already stopped
                    break;
            }
        }
Example #2
0
        /// <summary>
        /// Start the Actor.
        /// </summary>
        public void StartActor(DefaultValueManager defaultValueManager)
        {
            switch (_actorState)
            {
                case ActorStateEnum.ActorStopped:
                {
                    ICollection hl7Servers = _hl7Servers.Values;
                    foreach (Hl7Server hl7Server in hl7Servers)
                    {
                        // Each HL7 Server uses a HLI Thread internally.
                        // If this actor is attached to UserInterfaces that implement the
                        // IThreadUserInterface, attach the HLI thread to them.
                        AttachThreadToThreadUserInterfaces(hl7Server.Hl7Thread);

                        hl7Server.StartServer();
                    }

                    ICollection hl7Clients = _hl7Clients.Values;
                    foreach (Hl7Client hl7Client in hl7Clients)
                    {
                        // Each HL7 Client uses a HLI Thread internally.
                        // If this actor is attached to UserInterfaces that implement the
                        // IThreadUserInterface, attach the HLI thread to them.
                        AttachThreadToThreadUserInterfaces(hl7Client.Hl7Thread);

                        hl7Client.StartClient();
                    }

                    ICollection dicomServers = _dicomServers.Values;
                    foreach (DicomServer dicomServer in dicomServers)
                    {
                        // Each Dicom Server uses a HLI Thread internally.
                        // If this actor is attached to UserInterfaces that implement the
                        // IThreadUserInterface, attach the HLI thread to them.
                        AttachThreadToThreadUserInterfaces(dicomServer.Scp);

                        dicomServer.StartServer();
                    }

                    ICollection dicomClients = _dicomClients.Values;
                    foreach (DicomClient dicomClient in dicomClients)
                    {
                        // Each Dicom Client uses a HLI Thread internally.
                        // If this actor is attached to UserInterfaces that implement the
                        // IThreadUserInterface, attach the HLI thread to them.
                        AttachThreadToThreadUserInterfaces(dicomClient.Scu);

                        dicomClient.StartClient();
                    }

                    _actorState = ActorStateEnum.ActorStarted;

                    // Save the default value manager
                    _defaultValueManager = defaultValueManager;
                    break;
                }
                default:
                    // actor either not configured or already started
                    break;
            }
        }