コード例 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Initialize current shell information here, since it won't be accurate if we wait until after we create our own windows
            _initializationService.SetIsCairoRunningAsShell();

            Host.Start();

            _initializationService.WriteApplicationDebugInfoToConsole(productVersion: ProductVersion);

            _initializationService.LoadExtensions();

            _initializationService.SetTheme();

            if (Settings.Instance.ForceSoftwareRendering)
            {
                RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
            }

            base.OnStartup(e);

            _initializationService.SetupWindowServices();

            ShellHelper.SetShellReadyEvent();

#if !DEBUG
            // login items only necessary if Explorer didn't start them
            bool isRestart = false;

            try
            {
                isRestart = _options.CurrentValue.Restart;
            }
            catch (Exception ex)
            {
                _logger.LogError($"Unable to read restart command line option: {ex.Message}");
            }

            if (EnvironmentHelper.IsAppRunningAsShell && !isRestart)
            {
                StartupRunner runner = new StartupRunner();
                runner.Run();
            }
#endif
        }