//Updates events with given enum
        private void updateEvents()
        {
            //Updates string data from matches
            mainRank.setData(Preferences.Get("matchEventsString", ""));
            //Gets all data and sets it into ascending order based on each team's average time
            Dictionary <string, double> x     = mainRank.getRank(rankChoice);
            Dictionary <string, double> y     = new Dictionary <string, double> ();
            List <RankStruct>           ranks = new List <RankStruct> ();

            if (!(rankPicker.SelectedIndex == 7))
            {
                y = (from pair in x orderby pair.Value descending select pair).ToDictionary(pair => pair.Key, pair => pair.Value);
            }
            else
            {
                try {
                    y = (from pair in x orderby Convert.ToInt32(pair.Key.Split(" - ", 2) [0]) ascending select pair).ToDictionary(pair => pair.Key, pair => pair.Value);
                } catch {
                    y = new Dictionary <string, double> ();
                }
            }

            foreach (var s in y)
            {
                ranks.Add(new RankStruct {
                    Key = s.Key, Value = s.Value, color = getTeamColor(s.Key)
                });
            }
            listView.ItemsSource = ranks;
            rankList             = ranks;
            setListVisibility(y.Count());
        }
        //Updates events with given enum
        private void updateEvents()
        {
            //Updates string data from matches
            Debug.WriteLine(Preferences.Get(ConstantVars.APP_DATA_STORAGE, "reee"));
            //JObject temp = JObject.Parse(Preferences.Get(ConstantVars.APP_DATA_STORAGE, "{}"));
            //Debug.WriteLine(temp);
            //if (temp.ContainsKey(eventName))
            //{
            //    temp = (JObject)temp[eventName];
            //}
            //else
            //{
            //    temp = new JObject();
            //}
            mainRank.setData(App.getCompJson(Preferences.Get(ConstantVars.APP_DATA_STORAGE, "{}"), eventName));
            //Gets all data and sets it into ascending order based on each team's average time
            Dictionary <int, double> x     = mainRank.getRank(rankChoice);
            Dictionary <int, double> y     = new Dictionary <int, double>(x);
            List <RankStruct>        ranks = new List <RankStruct> ();

            if (!(rankPicker.SelectedIndex == 7))
            {
                y = (from pair in x orderby pair.Value descending select pair).ToDictionary(pair => pair.Key, pair => pair.Value);
            }
            else
            {
                try {
                    y = (from pair in x orderby pair.Key ascending select pair).ToDictionary(pair => pair.Key, pair => pair.Value);
                } catch {
                    y = new Dictionary <int, double> ();
                }
            }

            foreach (var s in y)
            {
                ranks.Add(new RankStruct {
                    Key = AdapterMethods.getTeamString(s.Key), Value = s.Value, color = getTeamColor(s.Key)
                });
            }
            listView.ItemsSource = ranks;
            rankList             = ranks;
            setListVisibility(y.Count());
        }
Example #3
0
        //Updates events with given enum
        private void updateEvents()
        {
            //Updates string data from matches
            mainRank.setData(Preferences.Get("matchEventsString", ""));
            //Gets all data and sets it into ascending order based on each team's average time
            Dictionary <string, double> x = mainRank.getRank(rankChoice);
            var y = from pair in x
                    orderby pair.Value ascending
                    select pair;

            setListVisibility(y.Count());
            List <RankStruct> ranks = new List <RankStruct> ();

            foreach (var s in y)
            {
                ranks.Add(new RankStruct {
                    Key = s.Key, Value = s.Value, color = getTeamColor(s.Key)
                });
                Console.WriteLine(getTeamColor(s.Key).ToString());
            }
            listView.ItemsSource = ranks;
        }