Пример #1
0
        protected override void Configure()
        {
            var logPath = LogSetup.GetLogsFolderPath("Logs");

            LogSetup.Execute();

            var directPath = Path.Combine(logPath, "ChocolateyGui.{Date}.log");

            var logConfig = new LoggerConfiguration()
                            .WriteTo.Async(config =>
                                           config.RollingFile(directPath, retainedFileCountLimit: 10, fileSizeLimitBytes: 150 * 1000 * 1000))
                            .SetDefaultLevel();

            Logger = Log.Logger = logConfig.CreateLogger();

            Container = AutoFacConfiguration.RegisterAutoFac(LicensedChocolateyGuiAssemblySimpleName, LicensedGuiAssemblyLocation);

            Internationalization.Initialize();
        }
Пример #2
0
        protected override void Configure()
        {
            LocalAppDataPath = Path.Combine(
                Environment.GetFolderPath(
                    Environment.SpecialFolder.LocalApplicationData,
                    Environment.SpecialFolderOption.DoNotVerify),
                ApplicationName);

            if (!Directory.Exists(LocalAppDataPath))
            {
                Directory.CreateDirectory(LocalAppDataPath);
            }

            AppDataPath = Path.Combine(
                Environment.GetFolderPath(
                    Environment.SpecialFolder.CommonApplicationData,
                    Environment.SpecialFolderOption.DoNotVerify),
                ApplicationName);

            Container = AutoFacConfiguration.RegisterAutoFac();
            var logPath = Path.Combine(AppDataPath, "Logs");

            if (!Directory.Exists(logPath))
            {
                Directory.CreateDirectory(logPath);
            }

            var directPath = Path.Combine(logPath, "ChocolateyGui.{Date}.log");

            var logConfig = new LoggerConfiguration()
                            .WriteTo.Async(config => config.LiterateConsole())
                            .WriteTo.Async(config =>
                                           config.RollingFile(directPath, retainedFileCountLimit: 10, fileSizeLimitBytes: 150 * 1000 * 1000))
                            .SetDefaultLevel();

            Logger = Log.Logger = logConfig.CreateLogger();

            Internationalization.Initialize();
        }
Пример #3
0
        /// <inheritdoc />
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            ThemeAssist.BundledTheme.Generate("ChocolateyGui");

            var configService          = Bootstrapper.Container.Resolve <IConfigService>();
            var effectiveConfiguration = configService.GetEffectiveConfiguration();

            ThemeMode themeMode;

            if (effectiveConfiguration.DefaultToDarkMode == null)
            {
                themeMode = ThemeMode.WindowsDefault;
            }
            else if (effectiveConfiguration.DefaultToDarkMode.Value)
            {
                themeMode = ThemeMode.Dark;
            }
            else
            {
                themeMode = ThemeMode.Light;
            }

            if (string.IsNullOrEmpty(effectiveConfiguration.UseLanguage))
            {
                Internationalization.Initialize();
                configService.SetConfigValue(nameof(effectiveConfiguration.UseLanguage), CultureInfo.CurrentCulture.Name);
            }
            else
            {
                Internationalization.UpdateLanguage(effectiveConfiguration.UseLanguage);
            }

            ThemeAssist.BundledTheme.SyncTheme(themeMode);
        }