private void MenuItemAssignReceipt_Click(object sender, RoutedEventArgs e) { try { AccountKey extendedKey = (AccountKey)tvWallet.SelectedItem; var invoice = (vwInvoicedReceipts)dgInvoices.SelectedItem; AssignKeyWindow assignKey = new AssignKeyWindow(); assignKey.InvoiceNumber = invoice.InvoiceNumber; assignKey.dgReceiptKeys.ItemsSource = tcBitcoin.NodeCash.fnChangeUnassigned(tcBitcoin.CashAccountCode); if (assignKey.ShowDialog() == true) { if (tcBitcoin.AssignReceiptKey(assignKey.KeyName, assignKey.PaymentAddress, assignKey.InvoiceNumber, assignKey.Note)) { Refresh(); OnBalance?.Invoke(this, new EventArgs()); } } } catch (Exception err) { MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error); } }