예제 #1
0
        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");
        }
예제 #2
0
 private void HandleTimeStoppage(object sender, TimerEventArgs e)
 {
     clockState = CLOCK_STATES.STOPPED;
     extractTimerFields(e);
     this.Dispatcher.InvokeAsync(() => {
         toggleClockButtonText();
         toggleClockTextBoxElements();
     });
     _log.Info("Time Stoppage");
 }
예제 #3
0
        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);
        }