예제 #1
0
        private async void updatePriceButton_Click(object sender, EventArgs e)
        {
            if (settingsWindow.GenerateBotSettings(out MKMBotSettings s))
            {
                bot.SetSettings(s);
                updatePriceButton.Enabled = false;
                updatePriceButton.Text    = "Updating...";
                await Task.Run(() => updatePriceRun());

                updatePriceButton.Text    = "Update Prices";
                updatePriceButton.Enabled = true;
            }
            else
            {
                logBox.AppendText("Update abandoned, incorrect setting parameters." + Environment.NewLine);
            }
        }
예제 #2
0
        private async void updatePriceButton_Click(object sender, EventArgs e)
        {
            if (bot.RunUpdate)
            {
                bot.RunUpdate             = false;
                updatePriceButton.Text    = "Stopping update...";
                updatePriceButton.Enabled = false;
            }
            else
            {
                if (settingsWindow.GenerateBotSettings(out MKMBotSettings s))
                {
                    uint lastUpdated = (uint)Properties.Settings.Default["LastUpdatedArticle"];
                    if (lastUpdated > 0u)
                    {
                        var result = MessageBox.Show("Last update did not finish (stopped with article #" + lastUpdated +
                                                     "), continue? (press No to restart from beginning, Cancel to cancel the update)",
                                                     "Continue last price update?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                        if (result == DialogResult.Yes)
                        {
                            lastUpdated++; // start from the next one
                        }
                        else if (result == DialogResult.No)
                        {
                            lastUpdated = 0u;
                        }
                        else
                        {
                            return;
                        }
                    }
                    bot.SetSettings(s);
                    updatePriceButton.Text = "Updating...\nClick to stop";
                    await Task.Run(() => updatePriceRun(lastUpdated));

                    updatePriceButton.Enabled = true;
                    updatePriceButton.Text    = "Update Prices";
                }
                else
                {
                    logBox.AppendText("Update abandoned, incorrect setting parameters." + Environment.NewLine);
                }
            }
        }
예제 #3
0
        private async void buttonAppraise_Click(object sender, EventArgs e)
        {
            bool MKMToolPrice = checkBoxToolPrices.Checked;
            bool PriceGuide   = checkBoxPriceGuide.Checked;

            if (MKMToolPrice || PriceGuide)
            {
                MKMBotSettings s;
                if (botSettings.GenerateBotSettings(out s))
                {
                    bot.SetSettings(s);
                    buttonImport.Enabled      = false;
                    buttonAppraise.Enabled    = false;
                    buttonExport.Enabled      = false;
                    buttonExportToMKM.Enabled = false;

                    buttonAppraise.Text = "Appraising...";
                    await Task.Run(() => appraise(MKMToolPrice, PriceGuide));

                    if (PriceGuide)
                    {
                        checkBoxExportPriceGuide.Checked = true;
                        checkBoxExportPriceGuide.Enabled = true;
                    }
                    if (MKMToolPrice)
                    {
                        checkBoxExportToolPrices.Checked = true;
                        checkBoxExportToolPrices.Enabled = true;
                    }

                    buttonImport.Enabled      = true;
                    buttonAppraise.Enabled    = true;
                    buttonExport.Enabled      = true;
                    buttonExportToMKM.Enabled = true;
                    buttonAppraise.Text       = "Appraise";
                }
                else
                {
                    MainView.Instance.LogMainWindow("Appraisal abandoned, incorrect setting parameters.");
                }
            }
            else
            {
                MainView.Instance.LogMainWindow("No price selected for appraisal.");
            }
        }