Beispiel #1
0
 private void delete_Click(object sender, RoutedEventArgs e)
 {
     Tools.Input coin = listInput.SelectedItem as Tools.Input;
     if (coin == null)
     {
         return;
     }
     listInput.Items.Remove(coin);
     updateOutput();
 }
Beispiel #2
0
        bool tx_fillThis(string assetid, ThinNeo.Fixed8 count)
        {
            if (assetid == "")
            {
                throw new Exception("refresh utxo first.");
            }

            var pubkey = ThinNeo.Helper.GetPublicKeyFromPrivateKey(this.privatekey);
            var hash   = ThinNeo.Helper.GetScriptHashFromPublicKey(pubkey);

            foreach (var coins in this.myasset.allcoins)
            {
                if (coins.AssetID == assetid)
                {
                    coins.coins.Sort((a, b) =>
                    {
                        return(Math.Sign(a.value - b.value));
                    });
                    decimal want   = count;
                    decimal inputv = 0;
                    foreach (var c in coins.coins)
                    {
                        Tools.Input input = new Tools.Input();
                        input.Coin = c;
                        input.From = hash;
                        this.listInput.Items.Add(input);
                        inputv += c.value;
                        if (inputv > want)
                        {
                            break;
                        }
                    }
                    if (inputv < want)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        private void ListBox_Drop(object sender, DragEventArgs e)
        {
            Tools.UTXOCoin coin = e.Data.GetData(typeof(Tools.UTXOCoin)) as Tools.UTXOCoin;
            foreach (Tools.Input itemcoin in listInput.Items)
            {
                if (itemcoin.Coin.fromID == coin.fromID && itemcoin.Coin.fromN == coin.fromN)
                {
                    MessageBox.Show("already have this input.");
                    return;
                }
            }
            var input = new Tools.Input();

            input.Coin = coin.Clone();
            var pubkey = ThinNeo.Helper.GetPublicKeyFromPrivateKey(this.privatekey);

            input.From = ThinNeo.Helper.GetScriptHashFromPublicKey(pubkey);
            listInput.Items.Add(input);
            updateOutput();
        }
Beispiel #4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.scripthash == null || this.script == null)
         {
             return;
         }
         var coin = this.listUTXO.SelectedItem as Tools.UTXOCoin;
         if (coin == null)
         {
             return;
         }
         this.value        = new Tools.Input();
         this.value.Coin   = coin;
         this.value.From   = this.scripthash;
         this.value.Script = this.script;
         this.DialogResult = true;
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }