Esempio n. 1
0
        public App()
        {
            // Configure some things
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings()
            {
                Converters = new List <JsonConverter>()
                {
                    new SemRangeConverter(), new SemVersionConverter()
                }
            };
            Settings                = Settings.Default;
            SteamAppLocator         = new SteamAppLocator(450540, "H3VR", "h3vr.exe");
            DiagnosticInfoCollector = new DiagnosticInfoCollector(SteamAppLocator);

            // Set the settings file location if we're installed via Steam
            if (!string.IsNullOrEmpty(SteamAppLocator.AppLocation))
            {
                PortableJsonSettingsProvider.SettingsDirectory = SteamAppLocator.AppLocation;
                PortableJsonSettingsProvider.SettingsFileName  = "DeliCounter.cfg";
                PortableJsonSettingsProvider.ApplyProvider(Settings);
            }


            // Initialize Sentry
            DiagnosticInfoCollector.InitSentry();

            // Check if Windows wants light or dark theme
            var  uiSettings            = new UISettings();
            var  color                 = uiSettings.GetColorValue(UIColorType.Background);
            bool darkModeRequestedByOS = color == Color.FromArgb(255, 0, 0, 0);

            // If this is our first run, honor the OS settings, otherwise keep what is in the settings
            if (Settings.FirstRun)
            {
                Settings.EnableDarkMode = darkModeRequestedByOS;
            }
            ThemeManager.Current.ApplicationTheme = Settings.EnableDarkMode ? ApplicationTheme.Dark : ApplicationTheme.Light;
        }
Esempio n. 2
0
 public static void Initialize(TestContext context)
 {
     settingsFile = "settings.json";
     PortableJsonSettingsProvider.ApplyProvider(Properties.Settings.Default);
     Properties.Settings.Default.Reset();
 }