Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            var logfile = ConfigurationLoader.GetAppSettingsValue("LogFile");

            var LoggingLevelsString = ConfigurationLoader.GetAppSettingsValue("LoggingLevels");
            LoggingLevels enumLowestTrace = LoggingLevels.Info;
            if (!string.IsNullOrEmpty(LoggingLevelsString))
            {
                if (Enum.TryParse(LoggingLevelsString, true, out enumLowestTrace))
                {
                    enumLowestTrace = enumLowestTrace;
                }
                else
                {
                    enumLowestTrace = LoggingLevels.Info;
                }
            }

            var fileAppsender = new FileAppender(logfile, enumLowestTrace, LoggingLevels.Trace);
            Log.AddAppender(fileAppsender);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     The init application.
        /// </summary>
        private void InitApplication()
        {
            var logfile = ConfigurationManager.AppSettings["LogFile"];

            var LoggingLevelsString = ConfigurationManager.AppSettings["LoggingLevels"];
            LoggingLevels enumLowestTrace = LoggingLevels.Info;
            if (!string.IsNullOrEmpty(LoggingLevelsString))
            {
                if (Enum.TryParse(LoggingLevelsString, true, out enumLowestTrace))
                {
                    enumLowestTrace = enumLowestTrace;
                }
                else
                {
                    enumLowestTrace = LoggingLevels.Info;
                }
            }

            var resultToLeon = ConfigurationManager.AppSettings["SendResultToLeon"];
            if (!string.IsNullOrEmpty(resultToLeon))
            {
                bool res = false;
                if (bool.TryParse(resultToLeon, out res))
                {
                    this.m_sendResultToLeon = res;
                }
            }
            else
            {
                this.m_sendResultToLeon = false;
            }

            var fileAppsender = new FileAppender(logfile, enumLowestTrace, LoggingLevels.Trace);
            Log.AddAppender(fileAppsender);
            Log.Info("Starting Config");

            this.m_OrionCommDetection = new OrionCommunicationDetection();
            this.m_OrionCommDetection.Init();
            this.m_leonCommDetection = new LeonCommunicationDetection();
            this.m_leonCommDetection.Init();
            this.m_DatabaseEngine = new DatabaseEngine();
            this.m_DatabaseEngine.Init();
            this.m_convertLeonToOrion = new ConvertOrionLeon();
            this.m_convertLeonToOrion.InitConverter();
        }