public void initInterfaceAndRelatedData() { timer.TimeStopped += HandleTimeStoppage; timer.Refresh += HandleRefresh; timer.setTimerFields(gameInfo, homeTeam, awayTeam); setGameClockInformation(); setPenaltyInformation(); GamePeriodPicker.SelectedIndex = 0; HomeNameTextBox.Text = homeTeam.name; HomeScore.Text = homeTeam.score.ToString(); AwayNameTextBox.Text = awayTeam.name; AwayScore.Text = awayTeam.score.ToString(); ClockToggleButton.Content = "Start"; clockState = CLOCK_STATES.STOPPED; bool hGoaliePulled = homeTeam.goaliePulled; bool aGoaliePulled = awayTeam.goaliePulled; HomeGoaliePulled.IsChecked = hGoaliePulled; AwayGoaliePulled.IsChecked = aGoaliePulled; homeTeam.goaliePulled = hGoaliePulled; awayTeam.goaliePulled = aGoaliePulled; calculateAndSetTimers(); DEBUG_LABEL.Text = "DEBUG"; BitmapImage bmp = filepathToImage(homeTeam.imagePath); if (bmp != null) { banner.HomeBackground.Source = bmp; } bmp = filepathToImage(awayTeam.imagePath); if (bmp != null) { banner.AwayBackground.Source = bmp; } HomeImage.Source = banner.HomeBackground.Source; AwayImage.Source = banner.AwayBackground.Source; if (gameInfo.reversedBanner) { swapTeamGrids(); banner.swapBannerPositions(); } banner.Show(); banner.Activate(); _log.Info("Initializing UI and Relevant Data"); }
private void HandleTimeStoppage(object sender, TimerEventArgs e) { clockState = CLOCK_STATES.STOPPED; extractTimerFields(e); this.Dispatcher.InvokeAsync(() => { toggleClockButtonText(); toggleClockTextBoxElements(); }); _log.Info("Time Stoppage"); }
private void toggleClock() { if (clockState == CLOCK_STATES.STOPPED) { timer.setTimerFields(gameInfo, homeTeam, awayTeam); timer.startClock(); clockState = CLOCK_STATES.RUNNING; toggleClockButtonText(); toggleClockTextBoxElements(); _log.Info("StartClock"); } else { timer.stopClock(); _log.Info("StopClock"); } DEBUG_LABEL.Text = "Toggle Clock Mode: " + clockState; _log.Debug(DEBUG_LABEL.Text); }