private async Task DeleteStorage(StorageViewModel storageViewModel) { if (await this.pageService.DisplayAlert("Warning", $"Are you sure you want to delete {storageViewModel}?", "Yes", "No")) { Storages.Remove(storageViewModel); var storage = await this.storageStore.GetStorage(storageViewModel.Id); await this.storageStore.DeleteStorage(storage); } }
private void OnStorageCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: foreach (var item in e.NewItems) { var model = item as NetworksStorageModel; Storages.Add(model.GetViewModel()); } break; case NotifyCollectionChangedAction.Remove: foreach (var item in e.OldItems) { var model = item as NetworksStorageModel; Storages.Remove(Storages.First(s => s.Id == model.Id.ToString())); } break; } }