Skip to content
Permalink
Browse files

Make confirmations more responsive.

  • Loading branch information...
nopara73 committed Nov 10, 2018
1 parent dba7b9a commit 95c10c1b21fcc52b674b49a19bff42b4a5ae13ee
@@ -32,6 +32,11 @@ public CoinViewModel(SmartCoin model)
{
this.RaisePropertyChanged(nameof(CoinJoinInProgress));
});

Global.IndexDownloader.WhenAnyValue(x => x.BestHeight).ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ =>
{
this.RaisePropertyChanged(nameof(Confirmations));
});
}

public SmartCoin Model { get; }
@@ -171,13 +171,17 @@ public StatusBarViewModel(NodesCollection nodes, MemPoolService memPoolService,
IndexDownloader = indexDownloader;
UpdateChecker = updateChecker;
IndexDownloader.NewFilter += IndexDownloader_NewFilter;
IndexDownloader.BestHeightChanged += IndexDownloader_BestHeightChanged;
IndexDownloader.TorStatusChanged += IndexDownloader_TorStatusChanged;
IndexDownloader.BackendStatusChanged += IndexDownloader_BackendStatusChanged;
IndexDownloader.ResponseArrivedIsGenSocksServFail += IndexDownloader_ResponseArrivedIsGenSocksServFail;

FiltersLeft = IndexDownloader.GetFiltersLeft();

IndexDownloader.WhenAnyValue(x => x.BestHeight).ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ =>
{
FiltersLeft = IndexDownloader.GetFiltersLeft();
});

this.WhenAnyValue(x => x.BlocksLeft).Subscribe(blocks =>
{
SetStatusAndDoUpdateActions();
@@ -313,11 +317,6 @@ private void IndexDownloader_NewFilter(object sender, Backend.Models.FilterModel
FiltersLeft = IndexDownloader.GetFiltersLeft();
}

private void IndexDownloader_BestHeightChanged(object sender, Height e)
{
FiltersLeft = IndexDownloader.GetFiltersLeft();
}

private void MemPoolService_TransactionReceived(object sender, SmartTransaction e)
{
Mempool = MemPoolService.TransactionHashes.Count;
@@ -347,7 +346,6 @@ protected virtual void Dispose(bool disposing)
Nodes.Removed -= Nodes_Removed;
MemPoolService.TransactionReceived -= MemPoolService_TransactionReceived;
IndexDownloader.NewFilter -= IndexDownloader_NewFilter;
IndexDownloader.BestHeightChanged -= IndexDownloader_BestHeightChanged;
IndexDownloader.TorStatusChanged -= IndexDownloader_TorStatusChanged;
IndexDownloader.BackendStatusChanged -= IndexDownloader_BackendStatusChanged;
IndexDownloader.ResponseArrivedIsGenSocksServFail -= IndexDownloader_ResponseArrivedIsGenSocksServFail;
@@ -15,10 +15,11 @@
using WalletWasabi.Backend.Models.Responses;
using WalletWasabi.Exceptions;
using WalletWasabi.WebClients.Wasabi;
using System.ComponentModel;

namespace WalletWasabi.Services
{
public class IndexDownloader : IDisposable
public class IndexDownloader : IDisposable, INotifyPropertyChanged
{
public Network Network { get; }

@@ -35,15 +36,13 @@ private set
if (_bestHeight != value)
{
_bestHeight = value;
BestHeightChanged?.Invoke(this, value);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BestHeight)));
}
}
}

public event EventHandler<bool> ResponseArrivedIsGenSocksServFail;

public event EventHandler<Height> BestHeightChanged;

private TorStatus _torStatus;

public TorStatus TorStatus
@@ -103,6 +102,8 @@ public int GetFiltersLeft()

public event EventHandler<FilterModel> NewFilter;

public event PropertyChangedEventHandler PropertyChanged;

public static FilterModel GetStartingFilter(Network network)
{
if (network == Network.Main)

2 comments on commit 95c10c1

@JuniperTonic

This comment has been minimized.

Copy link
Contributor

replied Nov 10, 2018

Seems to work! I was having trouble with the event handlers and it is good to see a solution. Thanks!

@nopara73

This comment has been minimized.

Copy link
Collaborator Author

replied Nov 11, 2018

It's not great because it doesn't dispose. It's not an issue until multi wallet support though.

Please sign in to comment.
You can’t perform that action at this time.