Exemple #1
0
        private void OnSyncedWallet()
        {
            var accountBalances   = Wallet.CalculateBalances(1); // 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);
                }
            });
            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;
        }
Exemple #2
0
        private void OnSyncedWallet()
        {
            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");

            overviewViewModel.AccountsCount = _wallet.EnumerateAccounts().Count();
            Application.Current.Dispatcher.Invoke(() =>
            {
                foreach (var tx in recentTx)
                {
                    overviewViewModel.RecentTransactions.Add(tx);
                }
            });
            SyncedBlockHeight = _wallet.ChainTip.Height;
            NotifyRecalculatedBalances();
            StartupWizardVisible = false;
        }