コード例 #1
0
        private static void Main(params string[] args)
        {
            try
            {
                InitializeLogger();
                InitializeInfoDialog();

                // In case the .exe is being run just for the sake of checking updates
                if (args.Length > 0)
                {
                    CheckForUpdates(args);
                }

                if (!SingleInstance.Start())
                {
                    return;
                }

                // Static initializations
                InstallLocation = Utilities.GetProductInstallLocation(AssemblyInfo.AssemblyTitle);

                // Update settings file
                UpdateSettingsFile();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.ThreadException += MySQLNotifierThreadExceptionEventHandler;

                // For Windows Forms errors to go through our handler.
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

                // For non-UI thread exceptions
                AppDomain.CurrentDomain.UnhandledException += MySQLNotifierAppExceptionHandler;

                // Initialize other static settings related to MySQL Installer and MySQL Workbench
                InitializeStaticSettings();

                // Initialize app context and run
                _applicationContext = new NotifierApplicationContext();
                Application.Run(_applicationContext);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex, true, Resources.MainApplicationErrorDetail);
            }

            SingleInstance.Stop();
        }
コード例 #2
0
        private static void Main(params string[] args)
        {
            try
            {
                // Initialize error handler settings
                MySqlSourceTrace.LogFilePath      = EnvironmentApplicationDataDirectory + ERROR_LOG_FILE_RELATIVE_PATH;
                MySqlSourceTrace.SourceTraceClass = "MySqlNotifier";

                // Static initializations
                InstallLocation = Utility.GetMySqlAppInstallLocation(AssemblyInfo.AssemblyTitle);
                InitializeStaticSettings();
                CustomizeInfoDialog();

                // Update settings file
                UpdateSettingsFile();

                // In case the .exe is being run just for the sake of checking updates
                if (args.Length > 0)
                {
                    CheckForUpdates(args[0]);
                }

                if (!SingleInstance.Start())
                {
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.ThreadException += MySQLNotifierThreadExceptionEventHandler;

                // For Windows Forms errors to go through our handler.
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

                // For non-UI thread exceptions
                AppDomain.CurrentDomain.UnhandledException += MySQLNotifierAppExceptionHandler;

                // Initialize app context and run
                _applicationContext = new NotifierApplicationContext();
                Application.Run(_applicationContext);
            }
            catch (Exception ex)
            {
                MySqlNotifierErrorHandler(ex, false);
            }

            SingleInstance.Stop();
        }