private void wrkrSuggestedReviews_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // Wipe out our list suggestedReviews.Clear(); if (e.Error != null) // We threw an exception in the worker thread { suggestedReviews.Add(new UserService.SuggestedReview() { displayText = "Error retrieving review suggestions!" }); suggestedReviews.Add(new UserService.SuggestedReview() { displayText = e.Error.Message }); isReviewSuggestionError = true; } else // Worker thread returned a JsonResult { // Get the response from the background thread JsonResult response = (JsonResult)e.Result; if (!response.isError()) // Check for server side errors { // Get the review suggestions suggestedReviews.AddRange(response.GetResponse <UserService.SuggestedReviewsResponse>().suggestedReviews); if (suggestedReviews.Count < 1) { // There are no review suggestions, tell the user, and treat it like an error suggestedReviews.Add(new UserService.SuggestedReview() { displayText = "There are no existing reviews that you can upload to." }); isReviewSuggestionError = true; } } else { suggestedReviews.Add(new UserService.SuggestedReview() { displayText = "Error retrieving review suggestions!" }); suggestedReviews.Add(new UserService.SuggestedReview() { displayText = response.GetErrorString() }); isReviewSuggestionError = true; } } // Hide the loading panel, even if we got an error pnlLoading.Visible = false; // Populate the list box with the response data bsReviewSuggestions.ResetBindings(false); // Clear currently selected review lbSuggestedReviews.SelectedIndex = -1; CheckForm(); }