private async void DeleteList() { try { var confirmPopup = new ConfirmationPopupPage() { Header = "Delete", Body = "Are you sure you want to delete this list?", ConfirmButtonText = "Yes" }; await _popupNavigation.PushAsync(confirmPopup); if (!await confirmPopup.Task) { return; } await _toDoService.DeleteList(_list.Id); await Navigation.PopAsync(); } catch (Exception ex) { Debug.Fail("Error deleting list", ex.Message); } }
private async void DeleteItem(ToDoItem item) { var confirmPopup = new ConfirmationPopupPage() { Header = "Delete", Body = "Are you sure you want to delete this item?", ConfirmButtonText = "Yes" }; await _popupNavigation.PushAsync(confirmPopup); if (!await confirmPopup.Task) { return; } try { await _toDoService.DeleteItem(_list.Id, item.Id); Items.Remove(item); OnPropertyChanged(nameof(Items)); // To show/hide list } catch (Exception ex) { Debug.Fail("Error deleting item", ex.Message); } }
private async void Delete(ToDoList list) { try { var confirmPopup = new ConfirmationPopupPage() { Header = "Delete", Body = "Are you sure you want to delete this list?", ConfirmButtonText = "Yes" }; await _popupNavigation.PushAsync(confirmPopup); if (!await confirmPopup.Task) { return; } await _toDoService.DeleteList(list.Id); Lists.Remove(list); OnPropertyChanged(nameof(Lists)); // To show/hide list } catch (Exception ex) { Debug.Fail("Error deleting list", ex.Message); } }