Reorganization
This commit is contained in:
44
Aurora/Services/SettingsService.cs
Normal file
44
Aurora/Services/SettingsService.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Plugin.Settings;
|
||||
using Plugin.Settings.Abstractions;
|
||||
|
||||
namespace Aurora.Services
|
||||
{
|
||||
public class SettingsService : BaseService<SettingsService>
|
||||
{
|
||||
private Lazy<ISettings> _appSettings;
|
||||
|
||||
public SettingsService()
|
||||
{
|
||||
}
|
||||
|
||||
public ISettings AppSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_appSettings == null)
|
||||
{
|
||||
_appSettings = new Lazy<ISettings>(() => CrossSettings.Current, LazyThreadSafetyMode.PublicationOnly);
|
||||
}
|
||||
|
||||
return _appSettings.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_appSettings = new Lazy<ISettings>(() => value, LazyThreadSafetyMode.PublicationOnly);
|
||||
}
|
||||
}
|
||||
|
||||
private string _usernameKey = "username";
|
||||
|
||||
public string Username
|
||||
{
|
||||
get { return AppSettings.GetValueOrDefault(_usernameKey, ""); }
|
||||
set
|
||||
{
|
||||
AppSettings.AddOrUpdateValue(_usernameKey, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user