/**
         * Updates notable scores
         */
        private void updateNotableScores()
        {
            Dictionary <string, int> notableScores = new Dictionary <string, int>();
            List <Shot> ulgss               = StatistiquesGolf.getShotsFromPartie(this.scorePartie, this.allShots).Where(sh => sh.ShotType.Equals(Shot.ShotCategory.UnexpectedLongShot)).ToList();
            string      key                 = "UnbelievableUnexpectedShot";
            double      max                 = 0.0;
            double      currentDist         = 0.0;
            int         i                   = 0;
            int         girCount            = 0;
            double      index               = StatistiquesGolf.getPlayerIndex();
            int         averageScorePerHole = (int)Math.Round(index / 18.0);

            //fills the dictionnary of relevent scores
            foreach (Shot shot in ulgss)//manages unbelievable unexpected shot index
            {
                currentDist = shot.RealShotDist();
                if (currentDist > max)
                {
                    max = currentDist;
                    notableScores[key] = i;
                }
                i++;
            }
            foreach (ScoreHole sh in this.scorePartie.scoreHoles)
            {
                if (sh.Score >= averageScorePerHole + 2)//manages bad scores count
                {
                    key = "More";
                    incrementDicoKey(notableScores, key);
                }
                else if (sh.Score <= 0)  //manages great scores count
                {
                    key = "" + sh.Score;
                    incrementDicoKey(notableScores, key);
                }
                if (sh.NombrePutt == 0)//manages approaches in count
                {
                    key = "approachIn";
                    incrementDicoKey(notableScores, key);
                }
                if (sh.NombrePutt == 1)//manages one putt count
                {
                    key = "onePutt";
                    incrementDicoKey(notableScores, key);
                }
                if (sh.Hit)//manages green in regulation count
                {
                    girCount++;
                }
            }

            int minScoreCount = 2;//for 9 holes or less

            if (this.scorePartie.scoreHoles.Count > 9)
            {
                minScoreCount = 4;
            }
            //checks if there are enought bad scores so that is relevent
            if (notableScores.ContainsKey("More"))
            {
                if (notableScores["More"] < minScoreCount)
                {
                    notableScores.Remove("More");
                }
            }
            //checks if there are enought pars so that is relevent
            if (notableScores.ContainsKey("0"))
            {
                int courseSizeMult = this.scorePartie.scoreHoles.Count / 9;//constants variate if it's a 9 or 18 holes
                int parMinCount    = this.scorePartie.scoreHoles.Count - averageScorePerHole * 3 * courseSizeMult;
                if (averageScorePerHole == 0)
                {
                    parMinCount = this.scorePartie.scoreHoles.Count - 2 * courseSizeMult;
                }
                if (parMinCount >= 1)
                {
                    if (notableScores["0"] < parMinCount)
                    {
                        notableScores.Remove("0");
                    }
                }
            }
            //checks if there are enought one putt so that is relevent
            if (notableScores.ContainsKey("onePutt"))
            {
                if (notableScores["onePutt"] < minScoreCount)
                {
                    notableScores.Remove("onePutt");
                }
            }

            //choses the more relevent scores
            int chosenCount = 0;

            i = 0;
            if (notableScores.Keys.Count > 1)
            {
                this.notableScore2Frame.IsVisible = true;
                this.notableScore2Label.IsVisible = true;

                for (int j = -3; j < 0; ++j)               //choses between albatros eagle and birdie
                {
                    if (notableScores.ContainsKey("" + j)) //albatros
                    {
                        updateNotableLabel(averageScorePerHole, this.notableScore1, this.notableScore1Label, "" + j, ulgss, notableScores);
                        chosenCount++;
                        break;
                    }
                }
                Label notForScore      = this.notableScore1;
                Label notForScoreLabel = this.notableScore1Label;
                if (chosenCount == 1)
                {
                    notForScore      = this.notableScore2;
                    notForScoreLabel = this.notableScore2Label;
                }
                //choses one between the ones left
                if (notableScores.ContainsKey("approachIn"))
                {
                    updateNotableLabel(averageScorePerHole, notForScore, notForScoreLabel, "approachIn", ulgss, notableScores);
                    chosenCount++;
                }
                else if (notableScores.ContainsKey("onePutt"))
                {
                    updateNotableLabel(averageScorePerHole, notForScore, notForScoreLabel, "onePutt", ulgss, notableScores);
                    chosenCount++;
                }
                else if (notableScores.ContainsKey("UnbelievableUnexpectedShot"))
                {
                    updateNotableLabel(averageScorePerHole, notForScore, notForScoreLabel, "UnbelievableUnexpectedShot", ulgss, notableScores);
                    chosenCount++;
                }

                if (chosenCount < 2)
                {
                    if (chosenCount == 0)//if par and more are left -> display GIR on the first labels
                    {
                        this.updateGIR(girCount);
                        if (notableScores.ContainsKey("More"))
                        {
                            updateNotableLabel(averageScorePerHole, this.notableScore2, this.notableScore2Label, "More", ulgss, notableScores);
                        }
                    }
                    else
                    {
                        if (notableScores.ContainsKey("More"))
                        {
                            updateNotableLabel(averageScorePerHole, this.notableScore2, this.notableScore2Label, "More", ulgss, notableScores);
                        }
                        else if (notableScores.ContainsKey("0"))
                        {
                            updateNotableLabel(averageScorePerHole, this.notableScore2, this.notableScore2Label, "0", ulgss, notableScores);
                        }
                        else
                        {
                            updateGIR(this.notableScore2, this.notableScore2Label, girCount);
                        }
                    }
                }
            }
            else
            {
                this.updateGIR(girCount);
                if (notableScores.Keys.Count == 1)
                {
                    updateNotableLabel(averageScorePerHole, this.notableScore2, this.notableScore2Label, notableScores.Keys.First(), ulgss, notableScores);
                    this.notableScore2Frame.IsVisible = true;
                    this.notableScore2Label.IsVisible = true;
                }
                else   //nothing notable
                {
                    this.notableScore2Frame.IsVisible = false;
                    this.notableScore2Label.IsVisible = false;
                }
            }
        }
        private void updateLast4Scores(List <GolfCourse> allGolfCourses, List <ScorePartie> allScoreParties)
        {
            int index    = (int)StatistiquesGolf.getPlayerIndex();
            int rowCount = last4ScoresGrid.Children.Count / 3;
            var scores   = allScoreParties.OrderByDescending(d => d.DateDebut).ToList();
            int col      = 0;
            int row      = 0;

            foreach (View label in last4ScoresGrid.Children)
            {
                if (row > 0)
                {
                    switch (col)
                    {
                    case 0:    //column golf name
                        if (row <= scores.Count)
                        {
                            string courseName = "";
                            string id         = scores[row - 1].scoreHoles[0].IdHole;
                            foreach (GolfCourse gc in allGolfCourses)
                            {
                                foreach (Hole h in gc.Holes)
                                {
                                    if (h.Id.Equals(id))
                                    {
                                        courseName = gc.Name;
                                        break;
                                    }
                                }
                            }
                            ((Label)label).Text = courseName;
                        }
                        else
                        {
                            ((Label)label).Text = NO_DATA_LIST;
                        }
                        break;

                    case 1:    //column date
                        if (row <= scores.Count)
                        {
                            ((Label)label).Text = "" + scores[row - 1].DateString;
                        }
                        else
                        {
                            ((Label)label).Text = NO_DATA_LIST;
                        }
                        break;

                    case 2:    //column score
                        if (row <= scores.Count)
                        {
                            Tuple <int, int> score = scores[row - 1].GetScore();
                            int perf = (int)((double)score.Item1 / (double)score.Item2 * 18.0) - index;
                            ((Label)label).Text = ((score.Item1 >= 0) ? "+" : "") + score.Item1 + " / " + score.Item2 + " trous";
                            if (perf == 0)    //you played your index
                            {
                                ((Label)label).TextColor = Color.Gray;
                            }
                            else if (perf < 0)    //you played better than your index
                            {
                                ((Label)label).TextColor = Color.Green;
                            }
                            else if (perf < 10)    //you played worse than your index
                            {
                                ((Label)label).TextColor = Color.Orange;
                            }
                            else    //you played than your index
                            {
                                ((Label)label).TextColor = Color.Red;
                            }
                        }
                        else
                        {
                            ((Label)label).Text = NO_DATA_LIST;
                        }
                        break;

                    default:
                        break;
                    }
                    row++;
                    if (row == rowCount)
                    {
                        row = 0;
                        col++;
                    }
                }
                else
                {
                    row++;
                }
            }
        }