private async void BlockButton_Click(object sender, RoutedEventArgs e) { foreach (Button bt in bts) { bt.Background = Brushes.CadetBlue; } Button clickButt = sender as Button; if (String.Equals(clickButt.Content, strings[wordIteration].En[charIteration])) { blocks.Children.Remove(clickButt); tbs[charIteration].Text = strings[wordIteration].En[charIteration].ToString(); charIteration++; if (charIteration == strings[wordIteration].En.Length && correctAnswer) { await MyDataBase.ChangeWordPriority(id, strings[wordIteration].En, -1); foreach (TextBlock tb in tbs) { tb.Background = Brushes.Green; } } } else { correctAnswer = false; clickButt.Background = Brushes.Red; } }
private async void butts_Click(Object sender, EventArgs args) { System.Windows.Controls.Button currentButt = (System.Windows.Controls.Button)sender; if (String.Equals(currentButt.Content, butts[buttIndexes[0]].Content)) { butts[buttIndexes[0]].Background = Brushes.Green; await MyDataBase.ChangeWordPriority(id, currentButt.Content.ToString(), -2); } else { butts[buttIndexes[0]].Background = Brushes.Green; currentButt.Background = Brushes.Red; } timer.Stop(); }
private async void Button_Click(object sender, RoutedEventArgs e) { await MyDataBase.ChangeWordPriority(id, enLabel.Content.ToString(), -10); ((Button)sender).Background = Brushes.Green; }