예제 #1
0
        public static async Task <LocalStorageValue <T> > CreateAsync(string keyname, ILocalStorageService localStorage)
        {
            var ret = new LocalStorageValue <T>(keyname, localStorage);
            var _   = await ret.RefreshValueAsync();

            return(ret);
        }
예제 #2
0
 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;
 }
예제 #3
0
 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());
         }
     }
 }