Make Loading... text and start history backend
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -3,6 +3,8 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
+using WalletWasabi.Models;
+using WalletWasabi.Services;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
@@ -10,11 +12,32 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
private ObservableCollection<TransactionViewModel> _transactions;
private TransactionViewModel _selectedTransaction;
+ private WalletService WalletService { get; }
public HistoryTabViewModel(WalletViewModel walletViewModel)
: base("History", walletViewModel)
{
+ WalletService = Global.WalletService;
+
Transactions = new ObservableCollection<TransactionViewModel>();
+
+ Height bestHeight = WalletService.IndexDownloader.BestHeight;
+ foreach (SmartCoin coin in WalletService.Coins)
+ {
+ }
+
+ WalletService.IndexDownloader.BestHeightChanged += IndexDownloader_BestHeightChanged;
+ WalletService.Coins.CollectionChanged += Coins_CollectionChanged;
+ }
+
+ private void Coins_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
+ {
+ //throw new NotImplementedException();
+ }
+
+ private void IndexDownloader_BestHeightChanged(object sender, Models.Height e)
+ {
+ //throw new NotImplementedException();
}
public ObservableCollection<TransactionViewModel> Transactions

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletView.xaml
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletView.xaml
<Button Command="{Binding LoadCommand}" DockPanel.Dock="Right">
<StackPanel Orientation="Horizontal">
<controls:Spinner Height="20" Width="20" IsVisible="{Binding IsBusy}" Margin="0 0 8 0" />
- <TextBlock Text="Load" />
+ <TextBlock Text="{Binding LoadButtonText}" />
</StackPanel>
</Button>
<Grid></Grid>

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -24,6 +24,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
private string _warningMessage;
private string _validationMessage;
private bool _isBusy;
+ private string _loadButtonText;
private WalletManagerViewModel Owner { get; }
@@ -44,6 +45,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
: string.Empty);
LoadCommand = ReactiveCommand.Create(LoadWalletAsync, this.WhenAnyValue(x => x.CanLoadWallet));
+ SetLoadButtonText(IsBusy);
}
public ObservableCollection<string> Wallets
@@ -76,6 +78,17 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
set { this.RaiseAndSetIfChanged(ref _validationMessage, value); }
}
+ public void SetLoadButtonText(bool isBusy)
+ {
+ LoadButtonText = isBusy ? "Loading..." : "Load Wallet";
+ }
+
+ public string LoadButtonText
+ {
+ get { return _loadButtonText; }
+ set { this.RaiseAndSetIfChanged(ref _loadButtonText, value); }
+ }
+
public bool CanLoadWallet
{
get
@@ -95,6 +108,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
set
{
CanLoadWallet = !value;
+ SetLoadButtonText(value);
this.RaiseAndSetIfChanged(ref _isBusy, value);
}
}
@@ -138,7 +152,8 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
try
{
- await Task.Run(async () => {
+ await Task.Run(async () =>
+ {
var walletFileInfo = new FileInfo(walletFullPath);
walletFileInfo.LastAccessTime = DateTime.Now;

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -20,6 +20,7 @@ using NBitcoin.Policy;
using NBitcoin.Protocol;
using Nito.AsyncEx;
using WalletWasabi.WebClients.ChaumianCoinJoin;
+using System.Collections.ObjectModel;
namespace WalletWasabi.Services
{
@@ -41,7 +42,7 @@ namespace WalletWasabi.Services
private HashSet<uint256> ProcessedBlocks { get; }
private AsyncLock WalletBlocksLock { get; }
- public ConcurrentHashSet<SmartCoin> Coins { get; }
+ public ConcurrentObservableHashSet<SmartCoin> Coins { get; }
public event EventHandler<FilterModel> NewFilterProcessed;
@@ -66,7 +67,7 @@ namespace WalletWasabi.Services
WalletBlocksLock = new AsyncLock();
HandleFiltersLock = new AsyncLock();
- Coins = new ConcurrentHashSet<SmartCoin>();
+ Coins = new ConcurrentObservableHashSet<SmartCoin>();
BlocksFolderPath = Guard.NotNullOrEmptyOrWhitespace(nameof(blocksFolderPath), blocksFolderPath, trim: true);
BlockFolderLock = new AsyncLock();
@@ -350,7 +351,7 @@ namespace WalletWasabi.Services
mixin += spentOwnCoins.Min(x => x.Mixin);
}
var coin = new SmartCoin(tx.GetHash(), i, output.ScriptPubKey, output.Value, tx.Transaction.Inputs.ToTxoRefs().ToArray(), tx.Height, tx.Transaction.RBF, mixin, foundKey.Label, spenderTransactionId: null, locked: false); // Don't inherit locked status from key, that's different.
- Coins.Add(coin);
+ Coins.TryAdd(coin);
if (coin.Unspent && coin.Label == "ZeroLink Change" && ChaumianClient.OnePiece != null)
{
Task.Run(async () =>

Make Loading... text and start history backend