private void selectFromChart()
        {
            if (cmbEventType.SelectedIndex == -1)
            {
                return;
            }

            var curEventKey = PlayByPlayEntry.EventTypes.Single(pair => pair.Value == cmbEventType.SelectedItem.ToString()).Key;

            if (curEventKey == 3 || curEventKey == 4)
            {
                return;
            }

            var w = new ShotChartWindow(curEventKey != PlayByPlayEntry.ShotAttemptEventType);
            w.ShowDialog();

            var close = false;

            var button = ShotChartWindow.LastButtonPressed;

            if (String.IsNullOrEmpty(button))
            {
                return;
            }

            if (curEventKey == PlayByPlayEntry.ShotAttemptEventType)
            {
                if (button.Contains("3PT"))
                {
                    cmbLocationShotDistance.SelectedIndex = 5;
                }
                else if (button.Contains("16"))
                {
                    cmbLocationShotDistance.SelectedIndex = 4;
                }
                else if (button.Contains("10"))
                {
                    cmbLocationShotDistance.SelectedIndex = 3;
                }
                else if (button.Contains("Close"))
                {
                    cmbLocationShotDistance.SelectedIndex = 2;
                    close = true;
                }
                else
                {
                    cmbLocationShotDistance.SelectedIndex = 1;
                }

                if (button.Contains("MidLeft"))
                {
                    cmbShotOrigin.SelectedIndex = 2;
                }
                else if (button.Contains("MidRight"))
                {
                    cmbShotOrigin.SelectedIndex = 4;
                }
                else if (button.Contains("Left"))
                {
                    cmbShotOrigin.SelectedIndex = 1;
                }
                else if (button.Contains("Mid"))
                {
                    cmbShotOrigin.SelectedIndex = close ? 2 : 3;
                }
                else if (button.Contains("Right"))
                {
                    cmbShotOrigin.SelectedIndex = close ? 3 : 5;
                }
                else
                {
                    cmbShotOrigin.SelectedIndex = 0;
                }
            }
            else
            {
                var key = ShotChartWindow.LastHalfSelected == "Offensive" ? 100 : 200;
                if (button.Contains("3PT"))
                {
                    key += 30;
                }
                else if (button.Contains("16"))
                {
                    key += 20;
                }
                else if (button.Contains("10"))
                {
                    key += 10;
                }
                else if (button.Contains("Close"))
                {
                    key += 10;
                    close = true;
                }

                if (button.Contains("MidLeft"))
                {
                    key += 1;
                }
                else if (button.Contains("MidRight"))
                {
                    key += 3;
                }
                else if (button.Contains("Mid"))
                {
                    key += close ? 1 : 2;
                }
                else if (button.Contains("Right"))
                {
                    key += close ? 2 : 4;
                }
                cmbLocationShotDistance.SelectedItem = PlayByPlayEntry.EventLocations[key];
            }
        }
        private void btnShotChart_Click(object sender, RoutedEventArgs e)
        {
            if (_curts == null || _curts.ID == -1 || _bseList == null)
            {
                return;
            }

            var dict = new Dictionary<int, PlayerPBPStats>();
            for (var i = 1; i <= 20; i++)
            {
                dict.Add(i, new PlayerPBPStats());
            }

            foreach (var bse in _bseList)
            {
                var teamPlayerIDs = bse.PBSList.Where(o => o.TeamID == _curts.ID).Select(o => o.PlayerID).ToList();
                var list = bse.PBPEList.Where(o => teamPlayerIDs.Contains(o.Player1ID) || teamPlayerIDs.Contains(o.Player2ID)).ToList();
                PlayerPBPStats.AddShotsToDictionary(ref dict, teamPlayerIDs, list);
            }

            var w = new ShotChartWindow(dict, Equals(sender, btnShotChartOff));
            w.ShowDialog();
        }
        private void btnShotChart_Click(object sender, RoutedEventArgs e)
        {
            if (_psr == null || _psr.ID == -1 || _bseList == null)
            {
                return;
            }

            var dict = new Dictionary<int, PlayerPBPStats>();
            for (var i = 2; i <= 20; i++)
            {
                dict.Add(i, new PlayerPBPStats());
            }

            var pIDList = new List<int> { _psr.ID };
            foreach (var bse in _bseList)
            {
                var list = bse.PBPEList.Where(o => o.Player1ID == _psr.ID || o.Player2ID == _psr.ID).ToList();
                PlayerPBPStats.AddShotsToDictionary(ref dict, pIDList, list);
            }

            var w = new ShotChartWindow(dict, Equals(sender, btnShotChartOff));
            w.ShowDialog();
        }