Read and Write Settings Plugin for Xamarin and Windows
Often you may need to share settings across your app installed on multiple device such as a watch. This is where shared settings and the fileName
come into play.
Each method takes an additional parameter called fileName
, which enables the setting to be stored a bit different on each platform.
All you need to do is pass in a file name for any of the settings:
private static ISettings AppSettings =>
CrossSettings.Current;
private const string WatchFile = "watch";
public static string UserName
{
get => AppSettings.GetValueOrDefault(nameof(UserName), string.Empty, WatchFile);
set => AppSettings.AddOrUpdateValue(nameof(UserName), value, WatchFile);
}
<= Back to Table of Contents