コード例 #1
0
ファイル: frmMain.cs プロジェクト: Stadtguerilla/idle_master
        public void SortBadges(string method)
        {
            lblDrops.Text = "Sorting results based on your settings, please wait...";
            switch (method)
            {
            case "mostcards":
                AllBadges = AllBadges.OrderByDescending(b => b.RemainingCard).ToList();
                break;

            case "leastcards":
                AllBadges = AllBadges.OrderBy(b => b.RemainingCard).ToList();
                break;

            case "mostvalue":
                var query = string.Format("http://api.enhancedsteam.com/market_data/average_card_prices/im.php?appids={0}",
                                          string.Join(",", AllBadges.Select(b => b.AppId)));
                var json          = new WebClient().DownloadString(query);
                var convertedJson = JsonConvert.DeserializeObject <EnhancedsteamHelper>(json);
                foreach (var price in convertedJson.Avg_Values)
                {
                    var badge = AllBadges.SingleOrDefault(b => b.AppId == price.AppId);
                    if (badge != null)
                    {
                        badge.AveragePrice = price.Avg_Price;
                    }
                }
                AllBadges = AllBadges.OrderByDescending(b => b.AveragePrice).ToList();
                break;

            default:
                return;
            }
        }
コード例 #2
0
        public void SortBadges(string method)
        {
            lblDrops.Text = localization.strings.sorting_results;
            switch (method)
            {
            case "mostcards":
                AllBadges = AllBadges.OrderByDescending(b => b.RemainingCard).ToList();
                break;

            case "leastcards":
                AllBadges = AllBadges.OrderBy(b => b.RemainingCard).ToList();
                break;

            default:
                return;
            }
        }