Created
January 3, 2017 18:47
-
-
Save wierzba3/9236c379e4e0fa668e7a92046aa66f34 to your computer and use it in GitHub Desktop.
Settings.cs file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helpers/SettingsModel.cs | |
using Plugin.Settings; | |
using Plugin.Settings.Abstractions; | |
namespace PatrolLiveApp.Helpers | |
{ | |
/// <summary> | |
/// This is the SettingsModel static class that can be used in your Core solution or in any | |
/// of your client applications. All settings are laid out the same exact way with getters | |
/// and setters. | |
/// </summary> | |
public static class Settings | |
{ | |
private static ISettings AppSettings | |
{ | |
get | |
{ | |
return CrossSettings.Current; | |
} | |
} | |
#region Setting Constants | |
private const string SettingsKey = "settings_key"; | |
private static readonly string SettingsDefault = string.Empty; | |
//the settings 'key' for the api key | |
private const string ApiKeyKey = "api_key"; | |
private static readonly string ApiKeyDefault = ""; | |
private const string DeviceIdKey = "device_id_key"; | |
private static readonly long DeviceIdDefault = 0; | |
#endregion | |
public static string ApiKey | |
{ | |
get { return AppSettings.GetValueOrDefault<string>(ApiKeyKey, ApiKeyDefault); } | |
set { AppSettings.AddOrUpdateValue<string>(ApiKeyKey, value); } | |
} | |
public static long DeviceId | |
{ | |
get { return AppSettings.GetValueOrDefault<long>(DeviceIdKey, DeviceIdDefault); } | |
set { AppSettings.AddOrUpdateValue<long>(DeviceIdKey, value); } | |
} | |
public static string GeneralSettings | |
{ | |
get | |
{ | |
return AppSettings.GetValueOrDefault<string>(SettingsKey, SettingsDefault); | |
} | |
set | |
{ | |
AppSettings.AddOrUpdateValue<string>(SettingsKey, value); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment