private void answer_Click(object sender, RoutedEventArgs e) { this.Cursor = Cursors.Wait; Thread.Sleep(500); textAnsver.Text = AnswerGenerator.GetRandomAnswer(); this.Cursor = null; }
private void cmdAnswer_Click(object sender, RoutedEventArgs e) { AnswerGenerator generator = new AnswerGenerator(); txtAnswer.Text = generator.GetRandomAnswer(txtQuestion.Text); LinearGradientBrush brush = new LinearGradientBrush(); GradientStop gradientStop1 = new GradientStop(); gradientStop1.Offset = 0; gradientStop1.Color = Colors.Yellow; brush.GradientStops.Add(gradientStop1); GradientStop gradientStop2 = new GradientStop(); gradientStop2.Offset = 0.5; gradientStop2.Color = Colors.White; brush.GradientStops.Add(gradientStop2); GradientStop gradientStop3 = new GradientStop(); gradientStop3.Offset = 1; gradientStop3.Color = Colors.Purple; brush.GradientStops.Add(gradientStop3); grid1.Background = brush; }
private void cmdAnswer_Click(object sender, RoutedEventArgs e) { // Dramatic delay... this.Cursor = Cursors.Wait; System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1)); AnswerGenerator generator = new AnswerGenerator(); txtAnswer.Text = generator.GetRandomAnswer(txtQuestion.Text); this.Cursor = null; }
private void AnswerButton_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1)); var generator = new AnswerGenerator(); AnswerTextBox.Text = generator.GetRandomAnswer(QuestionTextBox.Text); Cursor = null; }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1)); AnswerText.Text = AnswerGenerator.GetRandomAnswer(); Cursor = null; }
private void cmdAnswer_Click(object sender, RoutedEventArgs e) { Cursor = Cursors.Wait; Task.Delay(TimeSpan.FromSeconds(3)).GetAwaiter().GetResult(); var generator = new AnswerGenerator(); txtAnswer.Text = generator.GetRandomAnswer(txtQuestion.Text); Cursor = null; }
private void GetAnswerButton_OnClick(object sender, RoutedEventArgs e) { if (QuestionTextBox.Text.StartsWith("[")) { QuestionTextBox.Text = "[Please enter a question here]"; return; } Cursor = Cursors.Wait; System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1)); AnswerTextBox.Text = AnswerGenerator.GetRandomAnswer(); Cursor = null; }