Esempio n. 1
0
        private void StatsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (StatsComboBox.SelectedIndex != -1)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    StatsListView.Items.Clear();
                    PlayerStatSummary GameMode = Summaries[StatsComboBox.SelectedIndex];
                    foreach (SummaryAggStat stat in GameMode.AggregatedStats.Stats)
                    {
                        ProfilePage.KeyValueItem item = new ProfilePage.KeyValueItem
                        {
                            Key   = Client.TitleCaseString(stat.StatType.Replace('_', ' ')),
                            Value = stat.Value.ToString()
                        };
                        StatsListView.Items.Add(item);
                    }

                    //Resize columns
                    if (double.IsNaN(KeyHeader.Width))
                    {
                        KeyHeader.Width = KeyHeader.ActualWidth;
                    }
                    if (double.IsNaN(ValueHeader.Width))
                    {
                        ValueHeader.Width = ValueHeader.ActualWidth;
                    }
                    KeyHeader.Width   = double.NaN;
                    ValueHeader.Width = double.NaN;
                }));
            }
        }
 private void StatsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (StatsComboBox.SelectedIndex != -1)
     {
         Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
         {
             StatsListView.Items.Clear();
             PlayerStatSummary GameMode = Summaries[StatsComboBox.SelectedIndex];
             foreach (
                 KudosItem Item in GameMode.AggregatedStats.Stats.Select(stat => new ProfilePage.KeyValueItem
             {
                 Key = Client.TitleCaseString(stat.StatType.Replace('_', ' ')),
                 Value = stat.Value.ToString(CultureInfo.InvariantCulture)
             })
                 .Select(
                     item =>
                     new KudosItem(item.Key.ToString(), item.Value.ToString())
             {
                 MinWidth = GameMode.AggregatedStats.Stats.Count < 15 ? 972 : 962,
                 MinHeight = 18
             }))
             {
                 Item.TypeLabel.FontSize   = 12;
                 Item.AmountLabel.FontSize = 13;
                 StatsListView.Items.Add(Item);
             }
         }));
     }
 }
Esempio n. 3
0
        public void SetStatSummary(PlayerStatSummary stat, string ranking)
        {
            var values = new Dictionary <Control, string>()
            {
                { GameType, stat.PlayerStatSummaryType },
                { Ranking, ranking },
                { Wins, stat.Wins.ToString() },
                { Losses, stat.Losses.ToString() },
                { Leaves, stat.Leaves.ToString() }
            };

            foreach (var label in values)
            {
                label.Key.Text = Prepends[label.Key] + label.Value;
            }
        }
Esempio n. 4
0
        public void SetStatSummary(PlayerStatSummary stat)
        {
            var values = new Dictionary <Control, string>()
            {
                //{GameType, stat.PlayerStatSummaryType},
                //{MaxElo, stat.MaxRating.ToString()},
                //{Elo, stat.Rating.ToString()},
                { Wins, stat.Wins.ToString() },
                { Losses, stat.Losses.ToString() },
                { Leaves, stat.Leaves.ToString() }
            };

            foreach (var label in values)
            {
                label.Key.Text = Prepends[label.Key] + label.Value;
            }
        }
Esempio n. 5
0
        void SetSummaryParameters(DatabaseCommand command, MapType map, GameModeType gameMode, Summoner summoner, PlayerStatSummary summary, bool forceNullRating)
        {
            if (forceNullRating)
            {
                command.Set("current_rating", DbType.Int32, null);
                command.Set("top_rating", DbType.Int32, null);
            }
            else
            {
                //Zero rating means that the Elo is below 1200 and is not revealed by the server
                if (summary.rating == 0)
                {
                    command.Set("current_rating", DbType.Int32, null);
                }
                else
                {
                    command.Set("current_rating", summary.rating);
                }
                command.Set("top_rating", summary.maxRating);
            }

            command.Set("summoner_id", summoner.Id);
            command.Set("map", (int)map);
            command.Set("game_mode", (int)gameMode);

            command.Set("wins", summary.wins);
            command.Set("losses", summary.losses);
            command.Set("leaves", summary.leaves);
        }