public static async Task <LocalStorageValue <T> > CreateAsync(string keyname, ILocalStorageService localStorage) { var ret = new LocalStorageValue <T>(keyname, localStorage); var _ = await ret.RefreshValueAsync(); return(ret); }
public AppData(ILocalStorageService localStorage, NavigationManager navManager) { this.localStore = localStorage; this.navManager = navManager; PastHour = new LocalStorageValue <bool>("PastHour", localStore); Bearer = new LocalStorageValue <string>("AwairBearerToken", localStore); constructTime = DateTime.Now; }
public async Task AssignDeviceColors(QuickType.Devices devices) { foreach (var d in devices.DevicesDevices) { var colorval = new LocalStorageValue <int>($"{d.DeviceUuid}_Color", localStore); if (await colorval.Exists()) { d.Color = Color.FromArgb(await colorval.RefreshValueAsync()); } else { // save a new random color for this device await colorval.SetValueAsync(d.RandomizeColor().ToArgb()); } } }