private async Task GetOneAnswer() { Response.Children.Insert(0, new TextBlock { Text = await _client.GetOneAnswer(SearchQuery.Text), TextWrapping = TextWrapping.Wrap, Margin = new Thickness(4) }); }
private async void AskQuestion_Click(object sender, EventArgs e) { try { AskQuestion.Visible = false; AskQuestionProgress.Visible = true; AskQuestionProgress.Style = ProgressBarStyle.Marquee; var text = await _client.GetOneAnswer(SearchQuery.Text); ResponseList.Text = text + Environment.NewLine + Environment.NewLine + ResponseList.Text; } catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { AskQuestion.Visible = true; AskQuestionProgress.Visible = false; AskQuestionProgress.Style = ProgressBarStyle.Blocks; } }