Add back changes
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Composition;
using System.Linq;
+using System.Reactive.Disposables;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Gui.Tabs.WalletManager.GenerateWallets;
@@ -24,29 +25,10 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
private ObservableCollection<CategoryViewModel> _categories;
private CategoryViewModel _selectedCategory;
private ViewModelBase _currentView;
- private LoadWalletViewModel LoadWalletViewModelDesktop { get; }
+ private LoadWalletViewModel LoadWalletViewModelDesktop { get; set; }
public WalletManagerViewModel() : base("Wallet Manager")
{
- LoadWalletViewModelDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop);
-
- Categories = new ObservableCollection<CategoryViewModel>
- {
- new GenerateWalletViewModel(this),
- new RecoverWalletViewModel(this),
- LoadWalletViewModelDesktop,
- new LoadWalletViewModel(this, LoadWalletType.Password),
- new ConnectHardwareWalletViewModel(this)
- };
-
- SelectedCategory = Categories.FirstOrDefault();
-
- this.WhenAnyValue(x => x.SelectedCategory).Subscribe(category =>
- {
- category?.OnCategorySelected();
-
- CurrentView = category;
- });
}
public ObservableCollection<CategoryViewModel> Categories
@@ -89,5 +71,39 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
get => _currentView;
set => this.RaiseAndSetIfChanged(ref _currentView, value);
}
+
+ public override void OnOpen(CompositeDisposable disposables)
+ {
+ base.OnOpen(disposables);
+
+ LoadWalletViewModelDesktop = new LoadWalletViewModel(this, LoadWalletType.Desktop);
+
+ Categories = new ObservableCollection<CategoryViewModel>
+ {
+ new GenerateWalletViewModel(this),
+ new RecoverWalletViewModel(this),
+ LoadWalletViewModelDesktop,
+ new LoadWalletViewModel(this, LoadWalletType.Password),
+ new ConnectHardwareWalletViewModel(this)
+ };
+
+ SelectedCategory = Categories.FirstOrDefault();
+
+ this.WhenAnyValue(x => x.SelectedCategory).Subscribe(category =>
+ {
+ category?.OnCategorySelected();
+
+ CurrentView = category;
+ });
+ }
+
+ public override bool OnClose()
+ {
+ foreach (var tab in Categories.OfType<IDisposable>())
+ {
+ tab.Dispose();
+ }
+ return base.OnClose();
+ }
}
}

Add back changes