Exemplo n.º 1
0
        public void Stop()
        {
            // Method entry trace

            const string method = "Stop";

            if (EventSource.IsEnabled(Event.MethodEnter))
            {
                EventSource.Raise(Event.MethodEnter, method);
            }

            if (!_initialised)
            {
                throw new ContainerNotInitialisedException(typeof(Channel), method);
            }

            try
            {
                // Stop the source

                _source.Stop();

                // Update the status.

                _status = ChannelStatus.Stopped;
            }
            catch (Exception ex)
            {
                if (EventSource.IsEnabled(Event.CriticalError))
                {
                    EventSource.Raise(Event.CriticalError, method, "Cannot stop the channel.", ex);
                }
            }

            // Method exit trace

            if (EventSource.IsEnabled(Event.MethodExit))
            {
                EventSource.Raise(Event.MethodExit, method);
            }
        }