Ejemplo n.º 1
0
        public ControlSystem()
        {
            try
            {
                Thread.MaxNumberOfUserThreads = 100;
                var assembly = Assembly.GetExecutingAssembly();
                Tools.PrintLibInfo(assembly);

                #region Logging
#if DEBUG
                CloudLog.SystemLogLevel = LoggingLevel.Ok;
                CloudLog.Level          = LoggingLevel.Ok;
#else
                CloudLog.SystemLogLevel = LoggingLevel.Info;
                CloudLog.Level          = LoggingLevel.Info;
#endif
                CloudLog.RegisterConsoleService();

                #endregion

                #region System Config

                var config = ConfigManager.Config;

                if (config.SystemType == SystemType.NotConfigured)
                {
                    CloudLog.Warn("Config cannot generate automatically based on IP, please setup config manually!");
                }

                #endregion

                #region Load System

                switch (ConfigManager.Config.SystemType)
                {
                case SystemType.Classroom:
                    _system = new ClassroomSystem(this);
                    break;

                case SystemType.Auditorium:
                    _system = new AuditoriumSystem(this);
                    break;

                case SystemType.RoomMonitoring:
                    _system = new RoomMonitoringSystem(this);
                    break;

                case SystemType.FireAlarm:
                    _system = new FireAlarmMonitorSystem(this);
                    break;

                default:
                    _system = new MeetingSpaceSystem(this);
                    break;
                }

                #endregion
            }
            catch (Exception e)
            {
                CloudLog.Exception(e, "Error in ControlSystem.ctor()");
            }
        }