public SettingsViewModel(JsonSettingsService jsonSettingsService) { Header = "Settings"; Settings = new SettingsModel(); SettingsService = jsonSettingsService ?? new JsonSettingsService(); // create accent color menu items for the demo AccentColors = ThemeManager.Accents .Select(a => new AccentColorMenuData { Name = a.Name, ColorBrush = a.Resources["AccentColorBrush"] as Brush }) .ToList(); // create metro theme color menu items for the demo AppThemes = ThemeManager.AppThemes .Select(a => new AppThemeMenuData { Name = a.Name, BorderColorBrush = a.Resources["BlackColorBrush"] as Brush, ColorBrush = a.Resources["WhiteColorBrush"] as Brush }) .ToList(); Settings = SettingsService.ReloadSettings(); }
public EvepraisalAppraisalService() { _uriBuilder = new UriBuilder(Endpoint); _persistSetting = new AppraisalSetting <bool>( JsonSettingsService.CreateSetting("Persist", false)); _marketSetting = new AppraisalSetting <AppraisalMarket>( JsonSettingsService.CreateSetting("Market", AppraisalMarket.Jita)); }
public async Task TestSerialisation() { string file = Path.GetTempFileName(); JsonSettingsService service = await JsonSettingsService.CreateAsync(file); await service.RegisterSettingAsync("integer", 0); await service.RegisterSettingAsync("string", "string"); await service.RegisterSettingAsync <object>("object"); await service.StoreAsync(); JsonSettingsService service2 = await JsonSettingsService.CreateAsync(file); Assert.AreEqual(0, await service2.GetSettingAsync <int>("integer")); Assert.AreEqual("string", await service2.GetSettingAsync <string>("string")); Assert.True(await service2.IsRegisteredAsync("object")); }
public void RegisterTypes(IContainerRegistry containerRegistry) { _loggerFacade.Log("Registring settings extensions.", Category.Info, Priority.None); _container.Instance.AddNewExtension <SettingsServiceContainerExtension>(); string settingsPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Assembly.GetEntryAssembly().GetCustomAttribute <AssemblyProductAttribute>().Product, "settings.json" ); _loggerFacade.Log("Creating json settings service.", Category.Info, Priority.None); _loggerFacade.Log($"Loading settings from \"{settingsPath}\"", Category.Debug, Priority.None); ISettingsService settingsService = AsyncContext.Run(() => JsonSettingsService.CreateAsync(settingsPath)); _loggerFacade.Log("Settings loaded", Category.Info, Priority.None); containerRegistry.RegisterInstance(settingsService); _loggerFacade.Log("Module loaded", Category.Info, Priority.None); }
public JaniceAppraisalService() { _uriBuilder = new UriBuilder(Endpoint); _marketSetting = new AppraisalSetting <AppraisalMarket>( JsonSettingsService.CreateSetting("Market", AppraisalMarket.TheForge)); }