private void updateTimeLeftIndication(double timeLeft) { var pair = PlayByPlayEntry.TimeLeftToStringPair(timeLeft); txbTimeLeftInt.Text = pair.Key; txbTimeLeftDec.Text = pair.Value; }
private void updateShotClockIndication(double shotClock) { var pair = PlayByPlayEntry.ShotClockToStringPair(shotClock); txbShotClockLeftInt.Text = pair.Key; txbShotClockLeftDec.Text = pair.Value; }
private PlayByPlayEntry createPlayByPlayEntryFromCurrent() { var curPlayer = cmbPlayer1.SelectedItem as ComboBoxItemWithIsEnabled; var curPlayerTeam = _bse.PBSList.Single(pbs => pbs.PlayerID == curPlayer.ID).TeamID; var teamName = _tst[curPlayerTeam].DisplayName; var play = new PlayByPlayEntry { DisplayPlayer1 = cmbPlayer1.SelectedItem.ToString(), DisplayPlayer2 = cmbPlayer2.SelectedIndex != -1 ? cmbPlayer2.SelectedItem.ToString() : "", DisplayTeam = teamName, EventDesc = txtEventDesc.IsEnabled ? txtEventDesc.Text : "", EventType = PlayByPlayEntry.EventTypes.Single(item => item.Value == cmbEventType.SelectedItem.ToString()).Key, GameID = _bse.BS.ID, Location = grdShotEvent.IsEnabled ? -2 : PlayByPlayEntry.EventLocations.Single(item => item.Value == cmbLocationShotDistance.SelectedItem.ToString()) .Key, LocationDesc = txtLocationDesc.IsEnabled ? txtLocationDesc.Text : "", Player1ID = curPlayer.ID, Player2ID = (cmbPlayer2.IsEnabled && cmbPlayer2.SelectedIndex != -1) ? (cmbPlayer2.SelectedItem as ComboBoxItemWithIsEnabled).ID : -1, T1PTS = Convert.ToInt32(AwayPoints), T2PTS = Convert.ToInt32(HomePoints), Team1PlayerIDs = AwayActive.Select(ps => ps.ID).ToList(), Team2PlayerIDs = HomeActive.Select(ps => ps.ID).ToList(), ShotEntry = grdShotEvent.IsEnabled ? new ShotEntry( ShotEntry.ShotDistances.Single(item => item.Value == cmbLocationShotDistance.SelectedItem.ToString()).Key, ShotEntry.ShotOrigins.Single(item => item.Value == cmbShotOrigin.SelectedItem.ToString()).Key, ShotEntry.ShotTypes.Single(item => item.Value == cmbShotType.SelectedItem.ToString()).Key, chkShotIsMade.IsChecked == true, chkShotIsAssisted.IsChecked == true) : null, TimeLeft = _timeLeft, ShotClockLeft = _shotClock, Quarter = CurrentPeriod }; return(play); }
private void AddShotsFromSingleEntry(List <int> teamPlayerIDs, int distance, int origin, int type, PlayByPlayEntry e) { if (distance != -1 && e.ShotEntry.Distance != distance) { return; } if (origin != -1 && e.ShotEntry.Origin != origin) { return; } if (type != -1 && e.ShotEntry.Type != type) { return; } if (teamPlayerIDs.Contains(e.Player1ID)) { FGA++; if (e.ShotEntry.IsMade) { FGM++; if (e.ShotEntry.IsAssisted) { Assisted++; } } } else if (teamPlayerIDs.Contains(e.Player2ID)) { DefFGA++; if (e.ShotEntry.IsMade) { DefFGM++; if (e.ShotEntry.IsAssisted) { DefAssisted++; } } } }