Example #1
0
        public StatiticsViewModel()
        {
            newPlayer = new ObservableCollection <PlayerStatitics>();

            string player  = "";
            string imageid = "";
            string wins    = "";
            string losses  = "";


            System.Collections.Generic.IEnumerable <String> lines = File.ReadLines("..\\..\\Players.txt");


            for (int j = 0; j < lines.Count(); j++)

            {
                string[] playerElements = lines.ElementAt(j).Split(' ');
                int      i = 1;
                foreach (string word in playerElements)
                {
                    if (i == 1)
                    {
                        player = word;
                    }
                    else if (i == 2)
                    {
                        imageid = word;
                    }
                    else if (i == 8)
                    {
                        wins = word;
                    }
                    else if (i == 9)
                    {
                        losses = word;
                    }

                    i++;
                    Console.WriteLine(word + "\t");
                }
                newPlayer.Add(new PlayerStatitics(player, imageid, wins, losses));
            }
        }
Example #2
0
        private void DoSmth(object obj)
        {
            Players = new ObservableCollection <PlayerStatitics>();
            string player  = "";
            string imageid = "";
            string wins    = "";
            string losses  = "";

            System.Collections.Generic.IEnumerable <String> lines = File.ReadLines("..\\..\\Players.txt");

            if (obj.ToString() == "All-categories")
            {
                lines = File.ReadLines("..\\..\\AllCategories.txt");
            }
            if (obj.ToString() == "Animals")
            {
                lines = File.ReadLines("..\\..\\Animals.txt");
            }
            if (obj.ToString() == "Astronomy")
            {
                lines = File.ReadLines("..\\..\\Astronomy.txt");
            }
            if (obj.ToString() == "Cars")
            {
                lines = File.ReadLines("..\\..\\Cars.txt");
            }
            if (obj.ToString() == "Movies")
            {
                lines = File.ReadLines("..\\..\\Movies.txt");
            }
            if (obj.ToString() == "Music")
            {
                lines = File.ReadLines("..\\..\\Music.txt");
            }

            for (int j = 0; j < lines.Count(); j++)

            {
                string[] playerElements = lines.ElementAt(j).Split(' ');
                int      i = 1;
                foreach (string word in playerElements)
                {
                    if (i == 1)
                    {
                        Console.WriteLine("Player:");
                        player = word;
                    }
                    else if (i == 2)
                    {
                        imageid = word;
                    }
                    else if (i == 3)
                    {
                        wins = word;
                    }
                    else if (i == 4)
                    {
                        losses = word;
                    }
                    i++;
                }
                Players.Add(new PlayerStatitics(player, imageid, wins, losses));
            }
        }
Example #3
0
        public HomeViewModel()
        {
            newPlayer = new ObservableCollection <Player>();

            string player       = "";
            string imageid      = "";
            string lvl          = "";
            string secretWord   = "";
            string progress     = "";
            string letters      = "";
            string category     = "";
            string wins         = "";
            string losses       = "";
            string typedLetters = "";
            string time         = "";


            System.Collections.Generic.IEnumerable <String> lines = File.ReadLines("..\\..\\Players.txt");

            for (int j = 0; j < lines.Count(); j++)

            {
                string[] playerElements = lines.ElementAt(j).Split(' ');
                int      i = 1;
                foreach (string word in playerElements)
                {
                    if (i == 1)
                    {
                        player = word;
                    }
                    else if (i == 2)
                    {
                        imageid = word;
                    }
                    else if (i == 3)
                    {
                        category = word;
                    }
                    else if (i == 4)
                    {
                        lvl = word;
                    }
                    else if (i == 5)
                    {
                        secretWord = word;
                    }
                    else if (i == 6)
                    {
                        letters = word;
                    }
                    else if (i == 7)
                    {
                        progress = word;
                    }
                    else if (i == 8)
                    {
                        wins = word;
                    }
                    else if (i == 9)
                    {
                        losses = word;
                    }
                    else if (i == 10)
                    {
                        typedLetters = word;
                    }
                    else if (i == 11)
                    {
                        time = word;
                    }
                    i++;
                }
                newPlayer.Add(new Player(player, imageid, category, lvl, secretWord, letters, progress, wins, losses, typedLetters, time));
            }
        }