public async Task <bool> DeleteQuestionAnswersAsync(int id) { var questionsAnswers = QuestionsAnswers.Where(n => n.AnswerID == id).FirstOrDefault(); var result = await StoreManager.QuestionsDetailsService.DeleteAnswerAsync(questionsAnswers.Qid, questionsAnswers.AnswerID); if (result.Success) { var index = QuestionsAnswers.IndexOf(questionsAnswers); QuestionsAnswers.RemoveAt(index); if (QuestionsAnswers.Count == 0) { LoadStatus = LoadMoreStatus.StausNodata; } QuestionsDetails.CommentDisplay = (questions.AnswerCount = questions.AnswerCount - 1).ToString(); } else { Crashes.TrackError(new Exception() { Source = result.Message }); Toast.SendToast("删除失败"); } return(result.Success); }
private void DeleteQuestion() { if (MessageBox.Show("Är du säker på att du vill ta bort frågan?", "Bekräftelse", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Pictures.Remove(SelectedPicture); QuestionsAnswers.RemoveAt(SelectedQuestion - 1); LoadPreviousQuestion(); } }