private void Button_Click(object sender, RoutedEventArgs e) { if (Army == 0) { MessageBox.Show("请先选择队伍"); return; } Button button = sender as Button; if (button != null) { Question.QuestionNum = button.Content as string; Question question = new Question(); bool? r = question.ShowDialog(); if (r == true) { if (Army == 1) { button.Background = Army1.Background; Army = 2; AnswerArmy.Background = Army2.Background; } else { button.Background = Army2.Background; Army = 1; AnswerArmy.Background = Army1.Background; } } else { if (Army == 1) { button.Background = Army2.Background; Army = 2; AnswerArmy.Background = Army2.Background; } else { button.Background = Army1.Background; Army = 1; AnswerArmy.Background = Army1.Background; } } } }
public ObjectForScriptingHelper(Question main) { mainWindow = main; }