private async void PayAccount() { try { var invoice = (vwInvoicedPayments)dgInvoices.SelectedItem; AccountKey accountKey = (AccountKey)tvWallet.SelectedItem; PayAccountWindow payAccount = new PayAccountWindow(tcBitcoin, accountKey, invoice); if (payAccount.ShowDialog() == true) { Cursor = Cursors.Wait; SpendTx spendTx = await tcBitcoin.PayOutTx(accountKey, payAccount.PaymentAddress, payAccount.AmountToPay, payAccount.MinerRate, payAccount.TxMessage); if (!spendTx.IsSatisfied) { MessageBox.Show(Properties.Resources.UnsatisfiedPayment, payAccount.Title, MessageBoxButton.OK, MessageBoxImage.Error); tcBitcoin.PayOutCancel(spendTx); } else { Cursor = Cursors.Arrow; SpendConfirmWindow spendDialog = new SpendConfirmWindow(spendTx); if (spendDialog.ShowDialog() == true) { Cursor = Cursors.Wait; bool broadcast = await spendTx.Send(); if (broadcast) { if (tcBitcoin.PayAccountBalanceNode(spendTx, invoice.AccountCode, payAccount.CashCodeForChange)) { Refresh(); OnBalance?.Invoke(this, new EventArgs()); } } } else { tcBitcoin.PayOutCancel(spendTx); } } } } catch (Exception err) { MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error); } finally { Cursor = Cursors.Arrow; } }