This repository has been archived on 2020-12-20. You can view files and clone it, but cannot push or open issues or pull requests.
aurora-sharp-desktop/Aurora/Backend/Services/SettingsService.cs

36 lines
928 B
C#

using System;
using Xamarin.Forms;
namespace Aurora.Backend.Services
{
public class SettingsService : BaseService<SettingsService>
{
private string _usernameKey = "Username";
public SettingsService()
{
}
public string Username
{
get
{
if (!Application.Current.Properties.ContainsKey(_usernameKey))
{
return "";
}
Application.Current.Properties.TryGetValue(_usernameKey, out object val);
return val as string;
}
set
{
if (Application.Current.Properties.ContainsKey(_usernameKey))
{
Application.Current.Properties.Remove(_usernameKey);
}
Application.Current.Properties.Add(_usernameKey, value);
}
}
}
}