public void ShowQuestion()
{
int IDPhase = 0;
int countTeamChallenged = 0;
//count team is challenged
foreach (Team teamCS in flp_Team.Controls)
{
if (teamCS.chk_Challenged.Checked == true)
{
countTeamChallenged++;
}
}
//show question have challenge choice
if (CheckChallengeChoice == true)
{
if (countTeamChallenged == 0 || countTeamChallenged > NumofChallenge)
{
if (countTeamChallenged == 0)
{
MessageBox.Show("Please selected challenged team!");
}
else
{
MessageBox.Show("Maximum number of team will be challenged is " + NumofChallenge);
}
}
else
{
foreach (Team teamCS in flp_Team.Controls)
{
if (Convert.ToInt32(teamCS.lbl_Sequence.Text) == sequenceplayer(records.ElementAt(team).IDPlayer))
{
IDPhase = records.ElementAt(team).IDPhase;
//show question by id phase
if (ShowQuestionByIDPhase(IDPhase) == true)
{
teamCS.gb_team.Visible = false;
////////
audience.tbc_ShowGame.SelectedTab = audience.tab_ShowQuestion;
//sound show question
try
{
axWindowsMediaPlayer1.URL = (Directory.GetCurrentDirectory()) + "\\Sound\\HienThiCauHoi.wav";
axWindowsMediaPlayer1.Ctlcontrols.play();
}
catch (Exception)
{
}
step++;
}
else
{
MessageBox.Show("Run Out of Question");
OutOfQuestion();
}
}
}
}
}
else
{//show question don't have challenge choice
foreach (Team teamCS in flp_Team.Controls)
{
if (Convert.ToInt32(teamCS.lbl_Sequence.Text) == sequenceplayer(records.ElementAt(team).IDPlayer))
{
IDPhase = records.ElementAt(team).IDPhase;
//show question by id phase
if (ShowQuestionByIDPhase(IDPhase) == true)
{
if (records.ElementAt(team).Support == false)
{
teamCS.gb_team.Visible = false;
}
else
{
teamCS.chk_Support.Visible = true;
}
teamCS.chk_QuestionPM.Visible = false;
teamCS.chk_defy.Visible = false;
////////
audience.tbc_ShowGame.SelectedTab = audience.tab_ShowQuestion;
//sund show question
try
{
axWindowsMediaPlayer1.URL = (Directory.GetCurrentDirectory()) + "\\Sound\\HienThiCauHoi.wav";
axWindowsMediaPlayer1.Ctlcontrols.play();
}
catch (Exception)
{
}
step++;
}
else
{
MessageBox.Show("Run Out of Question");
OutOfQuestion();
}
}
}
}
}