Пример #1
0
        private void SteamSaleDataGridViewCellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0 || e.ColumnIndex < 0)
                {
                    return;
                }

                this.allItemsListGridUtils.UpdateItemDescription(
                    this.AllSteamItemsGridView.CurrentCell.RowIndex,
                    this.ItemDescriptionTextBox,
                    this.ItemImageBox,
                    this.ItemNameLable);

                switch (e.ColumnIndex)
                {
                    case 5:
                        this.allItemsListGridUtils.GridComboBoxClick(e.RowIndex);
                        break;
                    case 6:
                        this.allItemsListGridUtils.GridAddButtonClick(e.RowIndex, this.ItemsToSaleGridView);
                        PriceLoader.StartPriceLoading(ETableToLoad.ItemsToSaleTable);
                        break;
                }
            }
            catch (Exception ex)
            {
                Logger.Critical(@"Error on 'Market sell' - 'All items grid' cell click", ex);
            }
        }
        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);
            }
        }
Пример #3
0
 private void ForcePricesReloadButtonClick(object sender, EventArgs e)
 {
     try
     {
         PriceLoader.StartPriceLoading(ETableToLoad.ItemsToSaleTable, true);
     }
     catch (Exception ex)
     {
         Logger.Critical(ex);
     }
 }
Пример #4
0
        private void AddAllButtonClick(object sender, EventArgs e)
        {
            try
            {
                this.AllSteamItemsGridView.CurrentCellChanged -= this.AllSteamItemsGridViewCurrentCellChanged;

                this.ItemsToSaleGridView.CurrentCellChanged -= this.ItemsToSaleGridViewCurrentCellChanged;

                this.allItemsListGridUtils.AddCellListToSale(
                    this.ItemsToSaleGridView,
                    this.AllSteamItemsGridView.SelectedRows.Cast<DataGridViewRow>().ToArray());

                this.AllSteamItemsGridView.CurrentCellChanged += this.AllSteamItemsGridViewCurrentCellChanged;
                this.ItemsToSaleGridView.CurrentCellChanged += this.ItemsToSaleGridViewCurrentCellChanged;

                Logger.Debug("All selected items was added to sale list");
                PriceLoader.StartPriceLoading(ETableToLoad.ItemsToSaleTable);
            }
            catch (Exception ex)
            {
                Logger.Critical("Error on 'Market Sell' - 'Add all' button click", ex);
            }
        }
Пример #5
0
        private void LoadInventoryButtonClick(object sender, EventArgs e)
        {
            try
            {
                if (CurrentSession.SteamManager == null)
                {
                    MessageBox.Show(
                        @"You should login first",
                        @"Error inventory loading",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    Logger.Error("Error on inventory loading. No signed in account found.");
                    return;
                }

                if (string.IsNullOrEmpty(this.InventoryAppIdComboBox.Text)
                    || string.IsNullOrEmpty(this.InventoryContextIdComboBox.Text))
                {
                    MessageBox.Show(
                        @"You should chose inventory type first",
                        @"Error inventory loading",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    Logger.Error("Error on inventory loading. No inventory type chosed.");
                    return;
                }

                this.LoadInventoryButton.Enabled = false;

                string appid;
                switch (this.InventoryAppIdComboBox.Text)
                {
                    case "STEAM":
                        appid = "753";
                        break;
                    case "TF":
                        appid = "440";
                        break;
                    case "CS:GO":
                        appid = "730";
                        break;
                    case "PUBG":
                        appid = "578080";
                        break;
                    case "DOTA":
                        appid = "570";
                        break;
                    default:
                        appid = this.InventoryAppIdComboBox.Text;
                        break;
                }

                var contextId = this.InventoryContextIdComboBox.Text;
                CurrentSession.CurrentInventoryAppId = appid;
                CurrentSession.CurrentInventoryContextId = contextId;
                PriceLoader.StopAll();

                Logger.Debug($"Inventory {appid} - {contextId} loading started");

                Task.Run(
                    () =>
                        {
                            this.LoadInventory(
                                CurrentSession.SteamManager.Guard.Session.SteamID.ToString(),
                                appid,
                                contextId);
                            Logger.Info($"Inventory {appid} - {contextId} loading finished");
                            Dispatcher.AsMainForm(() => { this.LoadInventoryButton.Enabled = true; });
                            PriceLoader.StartPriceLoading(ETableToLoad.AllItemsTable);
                        });
            }
            catch (Exception ex)
            {
                Logger.Critical("Error on 'Market sell' - 'Load inventory' button click", ex);
            }
        }