Ive been using Montemagno's plugin for saving Settings but someone mentioned it's better to user preferences.essential. There's not much tutorial on it.
I'm having problem the getting and setting the value and accessing it from another file from where I set it.
//Settings.cs
public static string NameSettings
{
get
{
return AppSettings.GetValueOrDefault(SettingsnameKey, SettingsDefault);
}
set
{
AppSettings.AddOrUpdateValue(SettingsnameKey, value);
}
}
public static string DrainquantitySettings
{
get
{
return AppSettings.GetValueOrDefault(SettingsdrainxKey, SettingsDefault);
}
set
{
AppSettings.AddOrUpdateValue(SettingsdrainxKey, value);
}
}
//this is how i get it in another file
drainxPicker.SelectedItem = Settings.DrainquantitySettings;
nameEntry.Text = Settings.NameSettings;
//to set it
Settings.NameSettings = username;
Settings.DrainquantitySettings = item;
//to convert to preferences?
public static NameSettings
{
get => Preferences.Get(nameof(NameSettings), username);
set => Preferences.Set(nameof(NameSettings), value);
}
//to use it??
nameEntry.Text = Preferences.Settings.NameSettings;
//to set it??
Preferences.Settings.NameSettings = username;