예제 #1
0
        private void CalculateTotalToSpend()
        {
            try
            {
                var amountstring = textBoxAmount.Text.Replace(",", ".");
                var feestring    = textBoxFee.Text.Replace(",", ".");

                var checkAmount = CheckAmount(amountstring);
                var checkFee    = CheckAmount(feestring);
                if (checkAmount.Item1)
                {
                    var amountSend = checkAmount.Item2;
                    if (checkFee.Item1)
                    {
                        var feeSend = checkFee.Item2;
                        if (checkBoxHideWalletAddress.Checked)
                        {
                            if (CheckAmountNetwork(amountSend + feeSend +
                                                   ClassConnectorSetting.MinimumWalletTransactionAnonymousFee))
                            {
                                textBoxTotalSpend.ForeColor = Color.Green;
                            }
                            else
                            {
                                textBoxTotalSpend.ForeColor = Color.Red;
                            }

                            textBoxTotalSpend.Text = ClassUtility.FormatAmount(
                                (amountSend + feeSend + ClassConnectorSetting.MinimumWalletTransactionAnonymousFee)
                                .ToString().Replace(",", "."));
                        }
                        else
                        {
                            if (CheckAmountNetwork(amountSend + feeSend))
                            {
                                textBoxTotalSpend.ForeColor = Color.Green;
                            }
                            else
                            {
                                textBoxTotalSpend.ForeColor = Color.Red;
                            }
                            textBoxTotalSpend.Text =
                                ClassUtility.FormatAmount((amountSend + feeSend).ToString().Replace(",", "."));
                        }
                    }
                    else
                    {
                        textBoxTotalSpend.Text      = "N/A";
                        textBoxTotalSpend.ForeColor = Color.Black;
                    }
                }
                else
                {
                    textBoxTotalSpend.Text      = "N/A";
                    textBoxTotalSpend.ForeColor = Color.Black;
                }
            }
            catch
            {
                textBoxTotalSpend.Text      = "N/A";
                textBoxTotalSpend.ForeColor = Color.Black;
            }
        }