コード例 #1
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            if (this.EOScrollBarHost.Value == 0 || string.IsNullOrEmpty(EOTextBoxValueInputHost.Text))
            {
                return;
            }

            if (EOTextBoxValueInputHost.Text != this.EOScrollBarHost.Value.ToString())
            {
                return;
            }

            this.PurchasedAmount = this.EOScrollBarHost.Value;

            var confirmPurchaseDialog = new ConfirmPurchaseDialogForm(
                "  Buy item(s)",
                $"  Buy { this.PurchasedAmount } { this.Item.Name } for { this.Item.Price * this.PurchasedAmount } gold ?"
                );

            if (confirmPurchaseDialog.ShowDialog() == DialogResult.OK)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
        }
コード例 #2
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            if (this.Price < 1 || String.IsNullOrEmpty(EOTextBoxPrice.Text))
            {
                return;
            }

            if (this.Price < 1 || String.IsNullOrEmpty(EOTextBoxAmount.Text))
            {
                return;
            }

            if (!int.TryParse(EOTextBoxAmount.Text, out var amount))
            {
                return;
            }

            this.SellAmount = amount;

            var confirmSellDialog = new ConfirmPurchaseDialogForm(
                "  Sell item(s)",
                $"  Sell {this.SellAmount} {this.Item.Name} on the market for\n  {this.Price}g per item?"
                );

            if (confirmSellDialog.ShowDialog() == DialogResult.OK)
            {
                Program.PurchaseSound.Play();

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                this.DialogResult = DialogResult.Cancel;
                this.Close();
            }
        }