Beispiel #1
0
        /// <summary>
        /// Launches the application, initialising the logger, the database
        /// configuration and connection, the class definitions, the exception
        /// notifier and the synchronisation controller.  This method also
        /// carries out any version upgrades using the
        /// IApplicationVersionUpgrader, if specified.
        /// </summary>
        /// <returns>Returns true if launched successfully, false if not. A
        /// failed launch will result in error messages being sent to the log
        /// with further information about the failure.</returns>
        public virtual bool Startup()
        {
            IHabaneroLogger log = null;

            try {
                SetupApplicationNameAndVersion();
                SetupLogging();
                SetupExceptionNotifier();

                log = GlobalRegistry.LoggerFactory.GetLogger("HabaneroApp");
                LogAppStartingInfo(log);

                SetupDatabaseConnection();
                SetupSettings();
                SetupClassDefs();
                Upgrade();
            }
            catch (Exception ex) {
                string errorMessage = "There was a problem starting the application.";
                if (log != null)
                {
                    log.Log("---------------------------------------------" +
                            Environment.NewLine + ExceptionUtilities.GetExceptionString(ex, 0, true), LogCategory.Exception);
                    errorMessage += " Please look at the log file for details of the problem.";
                }
                if (GlobalRegistry.UIExceptionNotifier != null)
                {
                    GlobalRegistry.UIExceptionNotifier.Notify(
                        new UserException(errorMessage, ex),
                        "Problem in Startup:", "Problem in Startup");
                }
                return(false);
            }
            return(true);
        }
Beispiel #2
0
 private void LogAppStartingInfo(IHabaneroLogger log)
 {
     log.Log("---------------------------------------------------------------------", LogCategory.Debug);
     log.Log(string.Format("{0} v{1} starting", AppName, AppVersion), LogCategory.Debug);
     log.Log("---------------------------------------------------------------------", LogCategory.Debug);
 }
Beispiel #3
0
 private void LogAppStartingInfo(IHabaneroLogger log)
 {
     log.Log("---------------------------------------------------------------------", LogCategory.Debug);
     log.Log(string.Format("{0} v{1} starting", AppName, AppVersion), LogCategory.Debug);
     log.Log("---------------------------------------------------------------------", LogCategory.Debug);
 }