コード例 #1
0
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {//listUTXO
            this.listUTXO.Items.Clear();

            var json  = api_getUTXO(this.textAddr.Text).AsList();
            var asset = new Tools.Asset();

            asset.ParseUTXO(json);
            foreach (var t in asset.allcoins)
            {
                var aid = t.AssetID;
                foreach (var c in t.coins)
                {
                    this.listUTXO.Items.Add(c);
                }
            }
        }
コード例 #2
0
 private void Button_Click_5(object sender, RoutedEventArgs e)
 {
     if (lastCoinHeight == apiHeight)//高度一样就别刷了
     {
         return;
     }
     try
     {
         if (initCoins == false)
         {
             var json = api_getAllAssets();
             Tools.CoinTool.Load();
             Tools.CoinTool.ParseUtxoAsset(json.AsList());
             initCoins = true;
         }
     }
     catch (Exception err)
     {
         MessageBox.Show("InitCoins:" + err.Message);
     }
     try
     {
         var json = api_getUTXO().AsList();
         myasset = new Tools.Asset();
         myasset.ParseUTXO(json);
         foreach (var nep5 in Tools.CoinTool.assetNep5)
         {
             var dec = rpc_getNep5Balance(nep5.Key);
             if (dec > 0)
             {
                 var nep5coin = new Tools.CoinType(nep5.Key, true);
                 nep5coin.Value = dec;
                 myasset.allcoins.Add(nep5coin);
             }
         }
         lastCoinHeight       = apiHeight;
         infoAssetHeight.Text = "Refresh:" + lastCoinHeight;
         //fill item
         treeCoins.Items.Clear();
         foreach (var cointype in myasset.allcoins)
         {
             TreeViewItem item = new TreeViewItem();
             item.Tag = cointype;
             if (cointype.NEP5)
             {
                 item.Header = "(NEP5)" + Tools.CoinTool.GetName(cointype.AssetID) + ":" + cointype.Value;
             }
             else
             {
                 item.Header = "(UTXO)" + Tools.CoinTool.GetName(cointype.AssetID) + ":" + cointype.Value;
                 foreach (var coin in cointype.coins)
                 {
                     TreeViewItem itemUtxo = new TreeViewItem();
                     itemUtxo.Tag    = coin;
                     itemUtxo.Header = coin.value + " <== " + coin.fromID + "[" + coin.fromN + "]";
                     item.Items.Add(itemUtxo);
                 }
             }
             treeCoins.Items.Add(item);
         }
     }
     catch (Exception err)
     {
         MessageBox.Show("GetBalance:" + err.Message);
     }
 }