Awesome
ObservableSettings
Creating a Universal Windows App and can't found the Settings template in Visual Studio?
This base class helps you to create an observable, strongly typed settings class.
Usage
To use it follow the next steps:
- Reference the Common library proyect.
- Create a new class inheriting from ObservableSettings
- Call to the base class constructor indicating if you want to store the settings in LocalSettings or in RoamingSettings.
- Add all your properties calling the base class members Set and Get in the getter and in the setter.
Optionally you can set a default value decorating the property with DefaultSettingValue attribute.
Here an example of use:
namespace Test
{
public class Settings : ObservableSettings
{
private static Settings settings = new Settings();
public static Settings Default
{
get { return settings; }
}
public Settings()
: base(ApplicationData.Current.LocalSettings)
{
}
[DefaultSettingValue(Value = 115200)]
public int Bauds
{
get { return Get<int>(); }
set { Set(value); }
}
}
}
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
History
No history jet.
Credits
Thanks to Tam�s Deme (http://stackoverflow.com/users/4788286/tam%c3%a1s-deme) for helping me about reflection in Universal Windows Platform (http://stackoverflow.com/questions/35449747/why-my-uwp-app-cant-call-to-type-getproperties-method/35455271#35455271)
License
No license. Use it. Modify it. Enjoy it.