Esempio n. 1
0
        private void CloseButton_Click(object sender, EventArgs e)
        {
            var endProcess = new CMDProcess("C:\\Users\\Paul\\source\\repos\\Dashboard\\Dashboard\\electrum-daemon", "kill_daemon-rpc.bat");

            endProcess.Run();
            this.Close();
        }
Esempio n. 2
0
        private void InitalizeDashboard()
        {
            /* //Initalize Binance Info
             * BinanceAPI = new BinanceAuthenticator("DyQjRW8xyaAwwx7uu5EB3KUVXGnY5HPfW8Pkkd6djMvN9YnylHT4AOeKxZTDPrkV", "WCEA0bKYd1tw5BLjYW9o3HGyODWQCYiKlljjVn7RVOqV6vSRGBAZIKxGkc3dAF9Q");
             * var client = BinanceAPI.NewAPIClient();
             * var request = BinanceAPI.NewGetRequest("/api/v3/account", DataFormat.Json);
             * var response = client.Get(request);
             * var jsonObject = JObject.Parse(response.Content);
             * if (jsonObject.ContainsKey("balances"))
             * {
             * foreach (var item in jsonObject["balances"])
             * {
             *     if ((item["asset"].ToString()) == "BTC")
             *     {
             *         DashboardBinanceBalance.Text = item["free"].ToString();
             *         BinanceBalance = Int32.Parse(item["free"].ToString());
             *     }
             * }
             * }
             *
             * else
             * {
             * DashboardBinanceBalance.Text = "0 mBTC";
             * } */

            //Initialize Electrum info
            var startProcess = new CMDProcess("C:\\Users\\Paul\\source\\repos\\Dashboard\\Dashboard\\electrum-daemon", "start_daemon-rpc.bat");

            startProcess.Run();
            ElectrumBalance = Int32.Parse(((JObject.Parse(ElectrumRPC("getbalance", ""))["result"]["confirmed"]).ToString()));
            DashboardBinanceBalance.Text = ElectrumBalance.ToString() + " mBTC";


            var addresses = JObject.Parse(ElectrumRPC("listaddresses", ""))["result"];

            foreach (var address in addresses)
            {
                string paramList = "[\"" + address + "\"]";
                string balance   = JObject.Parse(ElectrumRPC("getaddressbalance", paramList))["result"]["confirmed"].ToString();
                var    row       = new string[] { address.ToString(), balance };
                var    lvi       = new ListViewItem(row);
                addressList.Items.Add(lvi);
            }
            tabControl.SelectedTab = tabPage1;
        }