示例#1
0
        public static void Main(string[] args)
        {
            #region Initialization Routines

            ProcessCommandLineArgs(args);
            if (!SingleInstanceCheck())
            {
                return;
            }
            SetShellReadyEvent();

            SetupSettings(); // run this before logging setup so that preferences are always used

            // Initialize current shell information here, since it won't be accurate if we wait until after we create our own windows
            SetIsCairoRunningAsShell();

            SetupLoggingSystem();
            WriteApplicationDebugInfoToConsole();

            SetSystemKeyboardShortcuts();

            SetupUpdateManager();

            // Move to App??? app.SetupPluginSystem();
            SetupPluginSystem(); // This will Load the Core Plugin and all other, will either reference it as a dependency or dont need it to be started first

            #endregion

            App app = new App();
            app.InitializeComponent();  // This sets up the Unhandled Exception stuff...

            setTheme(app);

            // Future: This should be moved to whatever plugin is responsible for MenuBar stuff
            MenuBar initialMenuBar = new MenuBar(System.Windows.Forms.Screen.PrimaryScreen);
            app.MainWindow = initialMenuBar;
            WindowManager.Instance.MenuBarWindows.Add(initialMenuBar);
            initialMenuBar.Show();

            // Future: This should be moved to whatever plugin is responsible for Taskbar stuff
            if (Settings.Instance.EnableTaskbar)
            {
                AppBarHelper.HideWindowsTaskbar();
                Taskbar initialTaskbar = new Taskbar(System.Windows.Forms.Screen.PrimaryScreen);
                WindowManager.Instance.TaskbarWindows.Add(initialTaskbar);
                initialTaskbar.Show();
            }

            // Open windows on secondary displays and set work area
            WindowManager.Instance.InitialSetup();

            // Future: This should be moved to whatever plugin is responsible for SystemTray stuff. Possibly Core with no UI, then have a plugin that gives the UI?
            // Don't allow showing both the Windows taskbar and the Cairo tray
            if (Settings.Instance.EnableSysTray && (Settings.Instance.EnableTaskbar || Shell.IsCairoRunningAsShell))
            {
                NotificationArea.Instance.Initialize();
            }

#if ENABLEFIRSTRUN
            FirstRun();
#endif

#if !DEBUG
            // login items only necessary if Explorer didn't start them
            if (Shell.IsCairoRunningAsShell && !isRestart)
            {
                StartupRunner runner = new StartupRunner();
                runner.Run();
            }
#endif

            app.Run();
        }