public async void ToolbarItem_OnDelete() { object item; if (post.isFirstPost) { bool answer = await DisplayAlert("Delete Forum Thread?", "Are you sure you want to permanently delete this forum thread and all of the responses?", "Yes", "No"); if (!answer) { return; } var temp_item = new DeleteForumThreadItem(); temp_item.Email = App.userEmail; temp_item.Password = App.userPassword; temp_item.DatabaseId = App.curClassroom.Id; temp_item.ThreadId = thread.Id; item = temp_item; } else { bool answer = await DisplayAlert("Delete Forum Post?", "Are you sure you want to permanently delete this forum post?", "Yes", "No"); if (!answer) { return; } var temp_item = new DeleteForumPostItem(); temp_item.Email = App.userEmail; temp_item.Password = App.userPassword; temp_item.DatabaseId = App.curClassroom.Id; temp_item.PostId = post.Id; item = temp_item; } sts.send(uri, item, async() => { await Navigation.PopAsync(); }); }
public async void ForumThreadItemCell_OnDelete(object sender, EventArgs e) { bool answer = await DisplayAlert("Delete Thread", "Are you sure you want to delete this thread and all of its replies?", "Yes", "No"); if (answer == false) { return; } var selectedThread = (ForumThreadItem)((MenuItem)sender).BindingContext; var item = new DeleteForumThreadItem(); item.DatabaseId = App.curClassroom.Id; item.Email = App.userEmail; item.Password = App.userPassword; item.ThreadId = selectedThread.Id; sts.send(uri, item, async() => { await DisplayAlert("Success", "The thread has been successfully deleted", "OK"); Handle_Refreshing(null, null); }); }