public PurchaseDialogForm(MarketRecord record, int amount) { InitializeComponent(); this.Item = record; this.Amount = amount; this.EOScrollBarHost.Maximum = this.Amount; this.EOScrollBarHost.ValueChanged += (s, e) => { if (EOTextBoxValueInputHost.Text != this.EOScrollBarHost.Value.ToString()) { EOTextBoxValueInputHost.Text = this.EOScrollBarHost.Value.ToString(); } }; this.EOTextBoxLabel.TextChanged += (s, e) => { if (EOTextBoxLabel.Text != this.EOScrollBarHost.Value.ToString()) { if (int.TryParse(EOTextBoxLabel.Text, out var value)) { EOScrollBarHost.Value = value; } } }; this.EOScrollBarHost.Value = 1; this.EOTextBoxValueInputHost.Text = this.EOScrollBarHost.Value.ToString(); this.EOTextBoxLabel.Text = " " + this.EOScrollBarHost.Value.ToString(); this.PurchaseDescription.Text = $"How much {this.Item.Name}\nwould you like to buy?"; this.PurchaseDescription.BringToFront(); }
public SellItemDialogForm(MarketForm market, MarketRecord record, int amount) { InitializeComponent(); this.Market = market; this.Item = record; this.Amount = amount; }