Example #1
0
        private void CloseWallet()
        {
            try
            {
                tcBitcoin.CloseWallet();
                MenuItemNewWallet.IsEnabled   = true;
                MenuItemMnemonics.IsEnabled   = true;
                MenuItemOpenWallet.IsEnabled  = true;
                MenuItemCloseWallet.IsEnabled = false;
                MenuItemSaveWallet.IsEnabled  = false;

                if (tvWallet.Items.Count > 0)
                {
                    var rootItem = (AccountKey)tvWallet.Items[0];
                    rootItem.Items.Clear();
                    rootItem.IsEnabled = false;
                }

                tvWallet.IsEnabled = false;

                if (pageTransactions.Content != null)
                {
                    var tx = (TxControl)pageTransactions.Content;
                    tx.Visibility = Visibility.Hidden;
                }

                if (pageToPay.Content != null)
                {
                    var toPay = (InvoicesControl)pageToPay.Content;
                    toPay.Visibility = Visibility.Hidden;
                }

                if (pageToReceive.Content != null)
                {
                    var toReceive = (InvoicesControl)pageToReceive.Content;
                    toReceive.Visibility = Visibility.Hidden;
                }

                if (pageReceiptKeys.Content != null)
                {
                    var receiptKeys = (ChangeControl)pageReceiptKeys.Content;
                    receiptKeys.Visibility = Visibility.Hidden;
                }

                if (pageChangeKeys.Content != null)
                {
                    var changeKeys = (ChangeControl)pageChangeKeys.Content;
                    changeKeys.Visibility = Visibility.Hidden;
                }
            }
            catch (Exception err)
            {
                MessageBox.Show($"{err.Message}", $"{err.Source}.{err.TargetSite.Name}", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }