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(); }
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(); }
/// <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); }