private void LoadListingButtonClick(object sender, EventArgs e) { try { if (CurrentSession.SteamManager == null) { MessageBox.Show( @"You should login first", @"Error market listing loading", MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.Error("Error on market listing loading. No signed in account found."); return; } this.AllSteamItemsGridView.Rows.Clear(); MyListings.Clear(); this.LoadListingButton.Enabled = false; Task.Run( () => { Program.LoadingForm.InitMyListingsLoadingProcess(); var listings = Program.LoadingForm.GetMyListings(); Program.LoadingForm.DeactivateForm(); var groupedListings = listings?.Sales?.GroupBy(x => new { x.HashName, x.Price }); if (groupedListings == null) { return; } foreach (var group in groupedListings) { var item = group.FirstOrDefault(); if (item == null) { return; } MyListings.Add(item.HashName + item.Price, group.ToList()); this.AddListing( item.Name, group.Count(), SteamItemsUtils.GetClearType(item.Game), item.Date, item.Price, item.HashName); } PriceLoader.StartPriceLoading(ETableToLoad.RelistTable); }); this.LoadListingButton.Enabled = true; } catch (Exception ex) { Logger.Critical("Error on loading listed market items", ex); } }
private void ChangeSelectedTrade() { CommonUtils.ClearGrids(this.MyItemsGridView, this.HisItemsGridView, this.ExtraTradeInfoGridView); var tradeOffer = this.allTrades[this.selectedOfferId]; if (tradeOffer.MyItems != null) { var gropedItems = tradeOffer.MyItems.GroupBy(item => item.Description.MarketHashName); foreach (var groupedList in gropedItems) { var firstItem = groupedList.First(); this.MyItemsGridView.Rows.Add( firstItem.Description.Name, groupedList.Sum(x => int.Parse(x.Asset.Amount)), SteamItemsUtils.GetClearType(firstItem), firstItem.Description); } } if (tradeOffer.HisItems != null) { var gropedItems = tradeOffer.HisItems.GroupBy(item => item.Description.MarketHashName); foreach (var groupedList in gropedItems) { var firstItem = groupedList.First(); this.HisItemsGridView.Rows.Add( firstItem.Description.Name, groupedList.Sum(x => int.Parse(x.Asset.Amount)), SteamItemsUtils.GetClearType(firstItem), firstItem.Description); } } this.ExtraTradeInfoGridView.Rows.Add("TradeId", tradeOffer.TradeId); this.ExtraTradeInfoGridView.Rows.Add( "TradeOfferState", tradeOffer.Status.ToString().Replace("TradeState", string.Empty)); this.ExtraTradeInfoGridView.Rows.Add("SteamIdOtherIdOther", tradeOffer.SteamIdOther); this.ExtraTradeInfoGridView.Rows.Add("TimeInit", tradeOffer.TimeInit); this.ExtraTradeInfoGridView.Rows.Add("TimeEscrowEnd", tradeOffer.TimeEscrowEnd); }
private void ChangeSelectedTrade() { try { CommonUtils.ClearGrids(this.MyItemsGridView, this.HisItemsGridView, this.ExtraTradeInfoGridView); var tradeOffer = this.allTrades[this.selectedOfferId]; if (tradeOffer.ItemsToGive != null) { var gropedItems = tradeOffer.ItemsToGive.GroupBy(item => item.Description.MarketHashName); foreach (var groupedList in gropedItems) { var firstItem = groupedList.First(); this.MyItemsGridView.Rows.Add( firstItem.Description.Name, groupedList.Sum(x => int.Parse(x.Asset.Amount)), SteamItemsUtils.GetClearType(firstItem), firstItem.Description); } } if (tradeOffer.ItemsToReceive != null) { var gropedItems = tradeOffer.ItemsToReceive.GroupBy(item => item.Description.MarketHashName); foreach (var groupedList in gropedItems) { var firstItem = groupedList.First(); this.HisItemsGridView.Rows.Add( firstItem.Description.Name, groupedList.Sum(x => int.Parse(x.Asset.Amount)), SteamItemsUtils.GetClearType(firstItem), firstItem.Description); } } this.ExtraTradeInfoGridView.Rows.Add("TradeOfferId", tradeOffer.Offer.TradeOfferId); this.ExtraTradeInfoGridView.Rows.Add( "TradeOfferState", tradeOffer.Offer.TradeOfferState.ToString().Replace("TradeOfferState", string.Empty)); this.ExtraTradeInfoGridView.Rows.Add("Message", tradeOffer.Offer.Message); this.ExtraTradeInfoGridView.Rows.Add("IsOurOffer", tradeOffer.Offer.IsOurOffer.ToString()); this.ExtraTradeInfoGridView.Rows.Add("AccountIdOther", tradeOffer.Offer.AccountIdOther.ToString()); var expirationTime = CommonUtils.ParseSteamUnixDate(tradeOffer.Offer.ExpirationTime) .ToString(CultureInfo.InvariantCulture); this.ExtraTradeInfoGridView.Rows.Add("ExpirationTime", expirationTime); this.ExtraTradeInfoGridView.Rows.Add( "ConfirmationMethod", tradeOffer.Offer.EConfirmationMethod.ToString().Replace("TradeOfferConfirmation", string.Empty)); var createdTime = CommonUtils.ParseSteamUnixDate(tradeOffer.Offer.TimeCreated) .ToString(CultureInfo.InvariantCulture); this.ExtraTradeInfoGridView.Rows.Add("TimeCreated", createdTime); var updatedTime = CommonUtils.ParseSteamUnixDate(tradeOffer.Offer.TimeUpdated) .ToString(CultureInfo.InvariantCulture); this.ExtraTradeInfoGridView.Rows.Add("TimeUpdated", updatedTime); this.ExtraTradeInfoGridView.Rows.Add("EscrowEndDate", tradeOffer.Offer.EscrowEndDate.ToString()); this.ExtraTradeInfoGridView.Rows.Add( "FromRealTimeTrade", tradeOffer.Offer.FromRealTimeTrade.ToString()); } catch (Exception ex) { Logger.Critical(ex); } }