_SettingsStarted.txt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Ensure that you install NuGet into PCL and see Helpers/Settings.cs
  2. If you are installing this in a normal project and not using a pcl create a new file called Settings.cs or whatever you want and copy this code in:
  3. // Helpers/Settings.cs
  4. using Refractored.Xam.Settings;
  5. using Refractored.Xam.Settings.Abstractions;
  6. namespace FormsPlayerSample.iOS.Helpers
  7. {
  8. /// <summary>
  9. /// This is the Settings static class that can be used in your Core solution or in any
  10. /// of your client applications. All settings are laid out the same exact way with getters
  11. /// and setters.
  12. /// </summary>
  13. public static class Settings
  14. {
  15. private static ISettings AppSettings
  16. {
  17. get
  18. {
  19. return CrossSettings.Current;
  20. }
  21. }
  22. #region Setting Constants
  23. private const string SettingsKey = "settings_key";
  24. private static readonly string SettingsDefault = string.Empty;
  25. #endregion
  26. public static string GeneralSettings
  27. {
  28. get
  29. {
  30. return AppSettings.GetValueOrDefault(SettingsKey, SettingsDefault);
  31. }
  32. set
  33. {
  34. AppSettings.AddOrUpdateValue(SettingsKey, value);
  35. }
  36. }
  37. }
  38. }