private void sendto_textchange(object sender, EventArgs e) { bool bValid = false; if (GetInfoFromAddressBook(true,m_SendTo.Text) != null) bValid = true; if (bValid == false) { MicroCashAddress address = new MicroCashAddress(m_SendTo.Text); if (address.IsPaymentCode) { m_SendToAmount.ReadOnly = true; m_TXInfo.ReadOnly = true; m_CreatePaymentCodeButton.Enabled = false; m_TXInfo.Text = address.GetPaymentAmountInfoString(); m_SendToAmount.Text = DoBalanceString(address.GetPaymentAmount()); } else if (address.IsLongAddress()) { m_TXInfo.ReadOnly = true; m_CreatePaymentCodeButton.Enabled = false; m_TXInfo.Text = address.GetPaymentAmountInfoString(); m_SendToAmount.ReadOnly = false; } else { m_CreatePaymentCodeButton.Enabled = true; m_SendToAmount.ReadOnly = false; m_TXInfo.ReadOnly = false; m_TXInfo.Text = ""; m_SendToAmount.Text = ""; } bValid = address.IsValid(); } if(bValid) m_SendTo.ForeColor = Color.FromArgb(0,0,0); else m_SendTo.ForeColor = Color.FromArgb(255,0,0); }
internal SendTxResult SendTx(MicroCashAddress paymentCodeAddress) { if (!paymentCodeAddress.IsPaymentCode) throw new ArgumentException("Address is not a payment code!", "paymentCodeAddress"); double amount = paymentCodeAddress.GetPaymentAmount() / 10000.0000; byte[] info = new byte[8]; Array.Copy(paymentCodeAddress.GetInfoBytes(), info, 8); return SendTx(paymentCodeAddress, amount, info); }