/// <summary> /// Updates Buy total when the amount/price to buy has changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpdateBuyTotal(object sender, EventArgs e) { decimal amount, price; if (decimal.TryParse(txtBuyAmount.Text, NumberStyles.Currency, CultureInfo.InvariantCulture, out amount) && decimal.TryParse(txtBuyPrice.Text, NumberStyles.Currency, CultureInfo.InvariantCulture, out price)) { decimal total = amount * price; decimal totalFee = total * _fee.BuyFee / 100m; bool feeDeductedFromTotal = _selectedPair.Exchange.FeeDeductedFromTotal; lblBuyFee.Text = string.Format("{0} {1}", totalFee.ToStandardFormat(), _proxy.GetFeeUnit(_selectedPair, OrderType.Buy)); lblBuyTotal.Text = string.Format("{0} {1}", (feeDeductedFromTotal ? total : total + totalFee).ToStandardFormat(), _selectedPair.Item2); } }