Пример #1
0
        /// <summary>
        /// Closes the application.  Generally, that should lead to the process being terminated.
        /// </summary>
        /// <remarks>
        /// All services that implement <see cref="IStartable"/> are stopped here, in reverse order that they
        /// have been started.
        /// </remarks>
        public virtual void CloseApplication()
        {
            foreach (IService service in ServiceProvider.AllServices.Reverse <IService>())
            {
                IStartable startable;
                startable = service as IStartable;
                if (startable != null)
                {
                    startable.Stop();
                }
            }

            ServiceProvider.Clear();
            PresentationController.ViewControllers.Clear();
            ObjectContainer.Clear();

            _started = false;
        }