Esempio n. 1
0
        private static void Main()
        {
            // Sets isDebugBuild variable to true if this is a debug build
            CheckIsDebug();

            // Quits non-debug builds if another instance already exists
            if (!s_isDebugBuild && !IsInstanceUnique)
            {
                return;
            }

            // Subscribe application's events (especially the unhandled exceptions management for the crash box)
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            Application.ThreadException += Application_ThreadException;
            Application.ApplicationExit += ApplicationExitCallback;
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Find our files
            EveClient.InitializeFileSystemPaths();

            // Creates a trace file
            EveClient.StartTraceLogging();
            EveClient.Trace("Starting up");

            // Make our windows nice
            MakeWindowsJuicy();

            // Check arguments
            bool startMinimized = Environment.GetCommandLineArgs().Contains("-startMinimized");

            // Initialization
            EveClient.Initialize();
            Settings.InitializeFromFile();

            // Did something requested an exit before we entered Run() ?
            if (s_exitRequested)
            {
                return;
            }

            // Fires the main window
            try
            {
                EveClient.Trace("Main loop - start");
                Application.Run(new MainWindow(startMinimized));
                EveClient.Trace("Main loop - done");
            }
            // Save before we quit
            finally
            {
                Settings.SaveImmediate();
                EveIDtoName.Save();
                BCAPI.UploadSettingsFile();
                EveClient.Trace("Closed");
                EveClient.StopTraceLogging();
            }
        }