コード例 #1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                textKeyName.Text = accountKey.KeyName;
                balance          = await tcBitcoin.KeyNameBalance(accountKey.KeyName);

                textBalance.Text     = $"{balance} {TCBitcoin.MILLI_BITCOIN_NAME}";
                textAccountName.Text = invoice.AccountName;
                PaymentAddress       = invoice.PaymentAddress;
                balanceOutstanding   = await tcBitcoin.NodeCash.AccountBalance(invoice.AccountCode);

                textOutstandingAmount.Text = $"{balanceOutstanding} {TCBitcoin.MILLI_BITCOIN_NAME}";
                AmountToPay = balanceOutstanding <= balance ? (decimal)balanceOutstanding : (decimal)balance;

                textCashCodeForChange.ItemsSource = tcBitcoin.NodeCash.vwTransferCashCodes
                                                    .Where(text => text.CashModeCode == (short)CashMode.Income)
                                                    .OrderBy(text => text.CashCode)
                                                    .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                                    .ToList();

                if (textCashCodeForChange.Items.Count > 0)
                {
                    textCashCodeForChange.SelectedIndex = 0;
                }

                MinerRates rates = new MinerRates((MinerRates.MiningSpeed)Properties.Settings.Default.MinersFeeSpeed);
                MinerRate = rates.GetFees(1);
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }
        }
コード例 #2
0
        async Task <bool> RefreshBalance()
        {
            try
            {
                if (SelectedKey != null)
                {
                    var namespaceBalance = await tcBitcoin.NamespaceBalance(SelectedKey.KeyName);

                    textBalance.Text = $"{namespaceBalance} {TCBitcoin.MILLI_BITCOIN_NAME}";
                    var keyBalance = await tcBitcoin.KeyNameBalance(SelectedKey.KeyName);

                    if (keyBalance != namespaceBalance)
                    {
                        textBalance.Text = $"({keyBalance}) {namespaceBalance} {TCBitcoin.MILLI_BITCOIN_NAME}";
                    }
                }

                return(true);
            }
            catch
            {
                textBalance.Text = $"0.0 {TCBitcoin.MILLI_BITCOIN_NAME}";
                return(false);
            }
        }
コード例 #3
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                textAmount.Focus();
                textKeyNameFrom.Text = accountKey.KeyName;
                TransferAmount       = 0;

                textKeyNameTo.ItemsSource = tcBitcoin.NodeCash.vwNamespaces
                                            .Where(text => text.CashAccountCode == tcBitcoin.CashAccountCode && text.KeyLevel > 0 && text.KeyName != accountKey.KeyName)
                                            .OrderBy(text => text.KeyName)
                                            .Select(text => text.KeyName).ToList <string>();

                if (textKeyNameTo.Items.Count > 0)
                {
                    textKeyNameTo.SelectedIndex = 0;
                }

                textCashCodeFrom.ItemsSource = tcBitcoin.NodeCash.vwTransferCashCodes
                                               .Where(text => text.CashModeCode == (short)CashMode.Expense)
                                               .OrderBy(text => text.CashCode)
                                               .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                               .ToList();

                if (textCashCodeFrom.Items.Count > 0)
                {
                    textCashCodeFrom.SelectedIndex = 0;
                }

                textCashCodeTo.ItemsSource = tcBitcoin.NodeCash.vwTransferCashCodes
                                             .Where(text => text.CashModeCode == (short)CashMode.Income)
                                             .OrderBy(text => text.CashCode)
                                             .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                             .ToList();

                if (textCashCodeTo.Items.Count > 0)
                {
                    textCashCodeTo.SelectedIndex = 0;
                }

                var balance = await tcBitcoin.KeyNameBalance(accountKey.KeyName);

                Balance = (decimal)balance;

                MinerRates rates = new MinerRates((MinerRates.MiningSpeed)Properties.Settings.Default.MinersFeeSpeed);
                MinerRate = rates.GetFees(1);
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #4
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                textAmount.Focus();
                textKeyNameFrom.Text = accountKey.KeyName;
                AmountToPay          = 0;

                textPaymentAddress.Focus();

                textCashCode.ItemsSource = tcBitcoin.NodeCash.vwCashCodes
                                           .Where(tb => tb.CashModeCode == (short)CashMode.Expense)
                                           .OrderBy(tb => tb.CashCode)
                                           .Select(cash_code => TCBitcoin.EmbedKey(cash_code.CashCode, $"{cash_code.CashDescription} ({cash_code.Category})"))
                                           .ToList();

                textTaxCode.ItemsSource = tcBitcoin.NodeCash.vwTaxCodes
                                          .OrderBy(tb => tb.TaxCode)
                                          .Select(tax_code => TCBitcoin.EmbedKey(tax_code.TaxCode, $"{tax_code.TaxDescription} ({tax_code.TaxType})"))
                                          .ToList();

                LoadOrgs();

                MinerRates rates = new MinerRates((MinerRates.MiningSpeed)Properties.Settings.Default.MinersFeeSpeed);
                MinerRate = rates.GetFees(1);

                var balance = await tcBitcoin.KeyNameBalance(accountKey.KeyName);

                Balance = (decimal)balance;
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
                Close();
            }
        }