/// <summary> /// Opens the page to add a food special for a restaurant. /// </summary> async void AddFoodSpec(object sender, EventArgs e) { if (tapped) { return; } tapped = true; var addFoodSpecialPage = new AddEditFoodSpec(_restaurant, FoodSpecialActions.Add); addFoodSpecialPage.Disappearing += async(send, args) => { await PopulateList(_restaurant); }; tapped = false; await Navigation.PushModalAsync(addFoodSpecialPage); }
async void ManageSpec(object sender, EventArgs e) { var action = await DisplayActionSheet("Actions", "Cancel", "Delete", new string[] { "Edit", "Copy", "Report" }); switch (action) { #region Case Delete case "Delete": var confirm = await DisplayAlert("Delete", "Are you sure you want to delete " + _spec.Title + "?", "Yes", "No"); if (confirm) { UserDialogs.Instance.ShowLoading("Deleting", MaskType.Black); IFoodSpecialService _foodSpecService = Startup.Container.Get <IFoodSpecialService>(); await _foodSpecService.Delete(_spec.SpecialId); UserDialogs.Instance.HideLoading(); await Navigation.PopAsync(); } break; #endregion #region Case Edit case "Edit": var editFoodSpecPage = new AddEditFoodSpec(_restaurant, FoodSpecialActions.Edit, _spec); editFoodSpecPage.Disappearing += (send, args) => { SetFields(); }; await Navigation.PushModalAsync(editFoodSpecPage); break; #endregion } }