make load to async
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/LoadingViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/LoadingViewModel.cs
@@ -4,6 +4,7 @@ using System.Reactive.Concurrency;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading;
+using System.Threading.Tasks;
using ReactiveUI;
using WalletWasabi.Blockchain.Blocks;
using WalletWasabi.Fluent.Helpers;
@@ -58,17 +59,17 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
Observable.FromEventPattern<bool>(Services.Synchronizer, nameof(Services.Synchronizer.ResponseArrivedIsGenSocksServFail))
.Select(x => x.EventArgs)
.Where(x => x)
- .Subscribe(_ => LoadWallet(disposables, syncFilters: false))
+ .Subscribe(async _ => await LoadWalletAsync(disposables, syncFilters: false))
.DisposeWith(disposables);
this.WhenAnyValue(x => x.IsBackendConnected)
.Where(x => x)
- .Subscribe(_ => LoadWallet(disposables, syncFilters: true))
+ .Subscribe(async _ => await LoadWalletAsync(disposables, syncFilters: true))
.DisposeWith(disposables);
}
}
- private void LoadWallet(CompositeDisposable disposables, bool syncFilters)
+ private async Task LoadWalletAsync(CompositeDisposable disposables, bool syncFilters)
{
if (_isLoading)
{
@@ -77,13 +78,17 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
_isLoading = true;
+ SetInitValues();
+
if (syncFilters)
{
- // TODO: filter sync here
+ while (RemainingFiltersToSync > 0)
+ {
+ await Task.Delay(1000);
+ }
}
- RxApp.MainThreadScheduler.Schedule(async () => await UiServices.WalletManager.LoadWalletAsync(_wallet));
- ShowFilterProcessingStatus(disposables);
+ await UiServices.WalletManager.LoadWalletAsync(_wallet);
}
private void ShowFilterProcessingStatus(CompositeDisposable disposables)

make load to async