Esempio n. 1
0
        private void UpdateTemps()
        {
            if (AmountBtc.Equals("0") || AmountCurr.Equals("0") || String.IsNullOrEmpty(AmountBtc) || String.IsNullOrEmpty(AmountCurr))
            {
                TempBalance = Balance;
                TempBalanceCurr = Math.Round(BalanceCurr,2);
                return;
            }

            decimal remainBtc = Balance.ToDecimal(MoneyUnit.BTC) - decimal.Parse(AmountBtc) - AmountFee.ToDecimal(MoneyUnit.BTC);
            if (remainBtc >= 0)
            {
                TempBalance = Money.FromUnit(remainBtc, MoneyUnit.BTC);
            }
            else
            {                
                TempBalance = 0;
            }

            decimal remainCurr = BalanceCurr - decimal.Parse(AmountCurr) - AmountFeeCurr;
            if (remainCurr >= 0)
            {
                TempBalanceCurr = Math.Round(remainCurr,2);
            }
            else
            {
                
                TempBalanceCurr = 0;
            }
        }
Esempio n. 2
0
        private void UpdateFee()
        {
            if (EnoughFunds(false) && !AmountBtc.Equals("0"))
            {
                var txBuilder = new TransactionBuilder();
                Money amountToSend = Money.Parse(AmountBtc);
                var fee = _wallet.CalculateFee(amountToSend);
                AmountFee = fee;
                AmountFeeCurr = Converters.Btc2Currency(fee);
            }
            else
            {
                AmountFee = Money.Zero;
            }

        }