public void HandleStorageEvent(JsonElement oEvent) { var evt = new StorageEvent(oEvent); _log.LogTrace("Raise local storage change event."); StorageUpdated?.Invoke(evt); }
public void Update(StorageObjectsRemoveMessage message) { for (int i = 0; i < message.ObjectUIDList.Count; i++) { Objects.RemoveAll(o => o.UID == message.ObjectUIDList[i]); } StorageUpdated?.Invoke(); }
public void Update(StorageObjectUpdateMessage message) { var obj = Objects.FirstOrDefault(f => f.UID == message.Object.ObjectUID); // Needs to be added if (obj == null) { Objects.Add(new ObjectEntry(message.Object, DataManager.Get <Items>((int)message.Object.ObjectGID))); } // Needs to be updated else { obj.Update(message.Object); } StorageUpdated?.Invoke(); }
public async Task SetItem(string key, string value) { _log.LogTrace("Set {key} in local storage", key); try { await _interop.InvokeVoidAsync(JSNamespace + ".LocalStorage.setItem", key, value); StorageUpdated?.Invoke(new StorageEvent(key, null, value)); } catch (JSException jsError) { var error = EnrichError.TryUnwrap(jsError); _log.LogError("JSError: " + error.Message); throw error; } }
public void Update(StorageObjectsUpdateMessage message) { for (int i = 0; i < message.ObjectList.Count; i++) { var obj = Objects.FirstOrDefault(f => f.UID == message.ObjectList[i].ObjectUID); // Needs to be added if (obj == null) { Objects.Add(new ObjectEntry(message.ObjectList[i], DataManager.Get <Items>((int)message.ObjectList[i].ObjectGID))); } // Needs to be updated else { obj.Update(message.ObjectList[i]); } } StorageUpdated?.Invoke(); }
private async Task Save() { if (String.IsNullOrWhiteSpace(Storage.StorageName)) { await this.pageService.DisplayAlert("Error", "Please enter a storage name.", "Ok"); return; } if (Storage.Id == 0) { await this.storageStore.AddStorageType(Storage); StorageAdded?.Invoke(this, Storage); } else { await this.storageStore.UpdateStorageType(Storage); StorageUpdated?.Invoke(this, Storage); } await this.pageService.PopAsync(); }
public async Task RemoveItem(string key) { await _interop.InvokeVoidAsync("window.localStorage.removeItem", key); StorageUpdated?.Invoke(new StorageEvent(key, null, null)); }
public async Task Clear() { await _interop.InvokeVoidAsync("window.localStorage.clear"); StorageUpdated?.Invoke(new StorageEvent(null, null, null)); }
public void Update(StorageObjectRemoveMessage message) { Objects.RemoveAll(o => o.UID == message.ObjectUID); StorageUpdated?.Invoke(); }
public void Update(StorageKamasUpdateMessage message) { Kamas = message.KamasTotal; StorageUpdated?.Invoke(); }