public override void Fireworks(List <Player> players) { int item = Lottery.GenerateValue(0, mRandomPreSelectLine.Length - 1); const int TIME_INCREMENT = 10; int index = 0; Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => { mMPlayerSpinningBox.Position = TimeSpan.Zero; mMPlayerSpinningBox.Play(); if (mRandomPreSelectLine.Length > 0) { mRandomPreSelectLine[item].Position = TimeSpan.Zero; mRandomPreSelectLine[item].Play(); } })); mIsRunning = true; while (mIsRunning) { mDisplayWinnerName.Dispatcher.BeginInvoke( (Action)(() => { if (index >= players.Count) { index = 0; } mDisplayWinnerName.Text = players[index].FullName; index++; }) ); Thread.Sleep(TIME_INCREMENT); } }
public override void DisplayWinner(Player winner) { mDisplayWinnerName.Dispatcher.BeginInvoke( (Action)(() => { mDisplayWinnerName.Foreground = new SolidColorBrush(Colors.Red); mDisplayWinnerName.Text = winner.FullName; mDisplayArea.Answer.Text = winner.Answers[0].Value; ShowAnswer(); mMPlayerSelectedSound.Position = TimeSpan.Zero; mMPlayerSelectedSound.Play(); if (mRandomOnSelectLine.Length > 0) { int item = Lottery.GenerateValue(0, mRandomOnSelectLine.Length - 1); mRandomOnSelectLine[item].Position = TimeSpan.Zero; mRandomOnSelectLine[item].Play(); } }) ); }