public void GetValues_HasValue_ReturnValue() { var key = "Foo"; var value = "abcd"; var settings = new WindowsUwpSettings(); settings.AddOrUpdateValue(key, value); Assert.AreEqual(value, settings.GetValue(key, "123")); }
/// <summary> /// Bind the saved theme from settings to the root element which cascadingly applies to children elements /// the reason this is bound in code behind is that because viewmodels are loaded after the pages, /// resulting to a nullreference exception if bound in xaml. /// </summary> private void SetColor() { // We have to create a own local settings object here since the general dependency // registration takes place later and the Theme can only be set in the constructor. if (new WindowsUwpSettings().GetValue(SettingsManager.USE_SYSTEM_THEME_KEYNAME, true)) { // System theme setting: // Light - #FFFFFFFF // Dark - #FF000000 RequestedTheme = new UISettings().GetColorValue(UIColorType.Background).ToString() == "#FF000000" ? ApplicationTheme.Dark : ApplicationTheme.Light; } else { RequestedTheme = new WindowsUwpSettings().GetValue(SettingsManager.DARK_THEME_SELECTED_KEYNAME, false) ? ApplicationTheme.Dark : ApplicationTheme.Light; } }
public void Ctor() { var settings = new WindowsUwpSettings(); Assert.IsNotNull(settings); }