public void AutoPopulation(List <Player> Scores)
        {
            if (Scores.Count == 0)
            {
                return;
            }
            int place = 0;

            foreach (var player in Scores)
            {
                int challegeScore = 0;
                for (int i = 0; i < Scores[place].Throws.Count; i++)
                {
                    foreach (string key in challenge.Keys)
                    {
                        if (Scores[place].Throws[i].Contains(key) ||
                            key != "X" &&
                            ((Scores[place].Throws[i].Contains("/") && Scores[place].Throws[i - 1].Contains((10 - Convert.ToInt32(key)).ToString())))
                            )
                        {
                            challegeScore += challenge[key];
                        }
                    }
                }

                AddPlayer(player.Name, challegeScore.ToString());
                place++;
            }
            int playerCounter = 2;

            foreach (var player in Scores)
            {
                int throwCounter = 0;
                for (int i = playerCounter; i < (playerCounter + 10); i++)
                {
                    if (i + 1 >= (playerCounter + 10))
                    {
                        ((Label)((Border)grid.Children[i]).Child).FontSize = 20;
                        ((Label)((Border)grid.Children[i]).Child).Content  = string.Format(" {0}  {1}  {2}", player.Throws[throwCounter], player.Throws[throwCounter + 1], player.Throws[throwCounter + 2]);
                    }
                    else
                    {
                        ((Label)((Border)grid.Children[i]).Child).FontSize = 20 + (20 - (Scores.Count * 2));
                        ((Label)((Border)grid.Children[i]).Child).Content  = string.Format(" {0}  {1} ", player.Throws[throwCounter], player.Throws[throwCounter + 1]);
                        throwCounter += 2;
                    }
                }
                playerCounter += 12;
            }
            List <int> activeFinder = new List <int>();
            int        counter      = 0;

            foreach (var player in Scores)
            {
                activeFinder.Add(0);
                for (int i = 0; i < player.Throws.Count; i++)
                {
                    if (player.Throws[i] == "" && player.Throws[i - 1] != "X")
                    {
                        activeFinder[counter]++;
                    }
                }
                counter++;
            }
            int  last    = activeFinder[0];
            bool changed = false;

            for (int i = 0; i < activeFinder.Count; i++)
            {
                if (activeFinder[i] > last)
                {
                    changed = true;
                    last    = i;
                    break;
                }
            }
            if (!changed)
            {
                last = 0;
            }
            for (int i = 2; i < 12; i++)
            {
                if (((Label)((Border)grid.Children[(last * 12) + i]).Child).Content == null || ((Label)((Border)grid.Children[(last * 12) + i]).Child).Content.ToString().Trim() == "")
                {
                    ((Border)grid.Children[(last * 12) + i]).Background = new SolidColorBrush(Colors.LightBlue);
                    break;
                }
            }

            string contentText = ((Label)((Border)grid.Children[(Scores.Count * 12) - 1]).Child).Content.ToString().Replace(" ", "");

            if ((contentText.Contains("X") && contentText.Length == 3) || (contentText.Contains("/") && contentText.Length == 3) ||
                ((!contentText.Contains("X") && !contentText.Contains("/")) && contentText.Length == 2))
            {
                XMLReadWrite XRW = new XMLReadWrite();
                XRW.XMLWrite(Scores, GUID, gameGUID);
            }
            if (Scores[0].Throws.Count < 2)
            {
                gameGUID = Guid.NewGuid().ToString();
            }



            AutoCalculateScore();
        }
        public void AutoPopulation(List<Player> Scores)
        {
            if (Scores.Count == 0)
                return;
            int place = 0;
            foreach (var player in Scores)
            {
                int challegeScore = 0;
                for(int i =0;i<Scores[place].Throws.Count;i++)
                {
                    foreach (string key in challenge.Keys)
                    {
                        if (Scores[place].Throws[i].Contains(key) ||
                            key != "X" &&
                            ((Scores[place].Throws[i].Contains("/") && Scores[place].Throws[i-1].Contains((10- Convert.ToInt32(key)).ToString())))
                            )
                        {
                            challegeScore += challenge[key];
                        }
                    }
                }

                AddPlayer(player.Name, challegeScore.ToString());
                place++;
            }
            int playerCounter = 2;
            foreach (var player in Scores)
            {
                int throwCounter = 0;
                for (int i = playerCounter; i < (playerCounter+10); i++)
                {
                    if (i + 1 >= (playerCounter + 10))
                    {
                        ((Label)((Border)grid.Children[i]).Child).FontSize = 20;
                        ((Label)((Border)grid.Children[i]).Child).Content = string.Format(" {0}  {1}  {2}", player.Throws[throwCounter], player.Throws[throwCounter + 1], player.Throws[throwCounter + 2]);
                    }
                    else
                    {
                        ((Label)((Border)grid.Children[i]).Child).FontSize = 20+ (20-(Scores.Count*2));
                        ((Label)((Border)grid.Children[i]).Child).Content = string.Format(" {0}  {1} ", player.Throws[throwCounter], player.Throws[throwCounter + 1]);
                        throwCounter += 2;
                    }
                }
                playerCounter += 12;
            }
            List<int> activeFinder = new List<int>();
            int counter = 0;
            foreach (var player in Scores)
            {
                activeFinder.Add(0);
                for (int i=0;i<player.Throws.Count;i++)
                {
                    if(player.Throws[i] == "" && player.Throws[i-1]!="X")
                    {
                        activeFinder[counter]++;
                    }
                }
                counter++;
            }
            int last = activeFinder[0];
            bool changed = false;
            for(int i =0;i< activeFinder.Count;i++)
            {
                if(activeFinder[i]> last)
                {
                    changed = true;
                    last = i;
                    break;
                }
            }
            if (!changed)
                last = 0;
            for (int i =2;i<12;i++)
            {
                if (((Label)((Border)grid.Children[(last * 12) + i]).Child).Content == null || ((Label)((Border)grid.Children[(last * 12) + i]).Child).Content.ToString().Trim() == "")
                {
                    ((Border)grid.Children[(last * 12) + i]).Background = new SolidColorBrush(Colors.LightBlue);
                    break;
                }
            }

            string contentText = ((Label)((Border)grid.Children[(Scores.Count * 12) - 1]).Child).Content.ToString().Replace(" ", "");
            if ((contentText.Contains("X") && contentText.Length == 3) || (contentText.Contains("/") && contentText.Length == 3)
                    || ((!contentText.Contains("X") && !contentText.Contains("/")) && contentText.Length == 2))
            {
                XMLReadWrite XRW = new XMLReadWrite();
                XRW.XMLWrite(Scores, GUID, gameGUID);
            }
            if(Scores[0].Throws.Count<2)
            {
                gameGUID = Guid.NewGuid().ToString();
            }

            AutoCalculateScore();
        }