Example #1
0
        private void LoadTransactionHistory()
        {
            BackgroundWork <List <XDagTransaction> > .CreateWork(
                this,
                () => {
                ////biTransactionHistoryLoading.IsBusy = true;
                this.grdBusyIndicator.Visibility = Visibility.Visible;
                this.tabItemHistory.IsEnabled    = false;
            },
                () => {
                List <XDagTransaction> transactions = XDagTransactionProvider.GetTransactionHistory(xdagWallet.Address);
                return(transactions);
            },
                (taskResult) => {
                ////biTransactionHistoryLoading.IsBusy = false;
                this.grdBusyIndicator.Visibility = Visibility.Hidden;
                this.tabItemHistory.IsEnabled    = true;

                if (taskResult.HasError)
                {
                    // Do nothing
                    return;
                }

                List <XDagTransaction> transactions = taskResult.Result;

                // Merge the Transaction results into the current history
                foreach (XDagTransaction tran in transactions)
                {
                    if (!transactionHistory.Any(t => (t.BlockAddress == tran.BlockAddress)))
                    {
                        transactionHistory.Add(tran);
                    }
                    else
                    {
                        XDagTransaction existing = transactionHistory.FirstOrDefault(t => (t.BlockAddress == tran.BlockAddress));
                        existing.MergeWith(tran);
                    }
                }

                /*
                 * foreach(XDagTransaction transaction in transactionHistory)
                 * {
                 *  LoadTransactionDataAsync(transaction);
                 * }
                 */
            }
                ).Execute();
        }
Example #2
0
        private void LoadTransactionDataAsync(XDagTransaction transaction)
        {
            if (!string.IsNullOrWhiteSpace(transaction.PartnerAddress))
            {
                return;
            }

            BackgroundWork.CreateWork(
                this,
                () => {
            },
                () => {
                XDagTransactionProvider.FillTransactionData(xdagWallet.Address, transaction);
                return(0);
            },
                (taskResult) => {
                this.dgdTransactionHistorySimple.Items.Refresh();
            }
                ).Execute();
        }