Paymetheus.Decred.Wallet.Wallet.EnumerateAccounts C# (CSharp) Method

EnumerateAccounts() public method

public EnumerateAccounts ( ) : AccountProperties>>.IEnumerable
return AccountProperties>>.IEnumerable
        public IEnumerable<TupleValue<Account, AccountProperties>> EnumerateAccounts()
        {
            return _bip0032Accounts.Select((p, i) => TupleValue.Create(new Account((uint)i), p))
                .Concat(new[] { TupleValue.Create(new Account(ImportedAccountNumber), _importedAccount) });
        }
    }

Usage Example

コード例 #1
0
        private void OnSyncedWallet(Wallet wallet)
        {
            var accountBalances = wallet.CalculateBalances(2); // TODO: configurable confirmations
            var accountViewModels = wallet.EnumerateAccounts()
                .Zip(accountBalances, (a, bals) => new AccountViewModel(a.Item1, a.Item2, bals))
                .ToList();

            var txSet = wallet.RecentTransactions;
            var recentTx = txSet.UnminedTransactions
                .Select(x => new TransactionViewModel(wallet, x.Value, BlockIdentity.Unmined))
                .Concat(txSet.MinedTransactions.ReverseList().SelectMany(b => b.Transactions.Select(tx => new TransactionViewModel(wallet, tx, b.Identity))))
                .Take(10);
            var overviewViewModel = (OverviewViewModel)SingletonViewModelLocator.Resolve("Overview");

            App.Current.Dispatcher.Invoke(() =>
            {
                foreach (var vm in accountViewModels)
                    Accounts.Add(vm);
                foreach (var tx in recentTx)
                    overviewViewModel.RecentTransactions.Add(tx);
            });
            TotalBalance = wallet.TotalBalance;
            TransactionCount = txSet.TransactionCount();
            SyncedBlockHeight = wallet.ChainTip.Height;
            SelectedAccount = accountViewModels[0];
            RaisePropertyChanged(nameof(TotalBalance));
            RaisePropertyChanged(nameof(AccountNames));
            overviewViewModel.AccountsCount = accountViewModels.Count();

            var shell = (ShellViewModel)ViewModelLocator.ShellViewModel;
            shell.StartupWizardVisible = false;
        }