Esempio n. 1
0
        /// <summary>
        /// Changes shutdown objects to signalled state.
        /// </summary>
        public void SignalShutdown()
        {
            log.Info("()");

            systemState = SystemStateType.Shutdown;
            GlobalShutdown.SignalShutdown();

            log.Info("(-)");
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes component manager, which leads to initialization of all other application components.
        /// </summary>
        /// <param name="ComponentList">List of components to initialize.</param>
        /// <returns>true if the function succeeds, false otherwise.</returns>
        public bool Init(List <Component> ComponentList)
        {
            log.Info("()");

            bool res = false;

            systemState = SystemStateType.Initiating;

            componentList = ComponentList;

            try
            {
                bool error = false;
                foreach (Component comp in componentList)
                {
                    string name = comp.InternalComponentName;
                    log.Info("Initializing component '{0}'.", name);
                    if (!comp.Init())
                    {
                        log.Error("Initialization of component '{0}' failed.", name);
                        error = true;
                        break;
                    }
                }

                if (!error)
                {
                    systemState = SystemStateType.Running;
                    res         = true;
                }
            }
            catch (Exception e)
            {
                log.Error("Exception occurred: {0}", e.ToString());
            }

            if (!res)
            {
                Shutdown();
            }

            log.Info("(-):{0}", res);
            return(res);
        }