Ejemplo n.º 1
0
        public void PopulateTransactionHistory()
        {
            TransactionHistory.Clear();

            // TODO: don't require every wallet transaction.  Consider alternate source for these
            // transactions.
            var walletTxs = _wallet.RecentTransactions.MinedTransactions
                            .SelectMany(b => b.Transactions)
                            .Concat(_wallet.RecentTransactions.UnminedTransactions.Select(kvp => kvp.Value));
            Amount runningBalance = 0;

            foreach (var tx in walletTxs)
            {
                Amount debit, credit;
                if (Accounting.RelevantTransaction(tx, _account, out debit, out credit))
                {
                    Amount delta = debit + credit;
                    runningBalance += delta;

                    var accountTransaction = new AccountTransactionViewModel(tx, delta, runningBalance);
                    TransactionHistory.Add(accountTransaction);
                }
            }
        }