Exemplo n.º 1
0
 private void send_Click_1(object sender, EventArgs e)
 {
     if (address_textBox.Text == "" && amount_numericUpDown.Value == 0)
     {
         error_label.Text = "Please enter the fields!";
     }
     else
     {
         IBitcoinService bitcoinService = new BitcoinService();
         var             a = bitcoinService.ValidateAddress(address_textBox.Text);
         Console.WriteLine(a);
         if (a.IsValid == true)
         {
             if (amount_numericUpDown.Value <= bitcoinService.GetBalance())
             {
                 var b = Convert.ToDecimal(amount_numericUpDown.Value);
                 bitcoinService.SendToAddress(address_textBox.Text, b, null, null);
                 error_label.Text = "Send Successfully!";
             }
             else
             {
                 error_label.Text = "Please enter valid amount !";
             }
         }
         else
         {
             error_label.Text = "Please enter a valid address!";
         }
     }
 }