Add Load Button to the Load Wallet
MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletView.xaml
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletView.xaml
<ListBox Items="{Binding Wallets}" SelectedItem="{Binding SelectedWallet, Mode=TwoWay}" />
</Grid>
</controls:GroupBox>
+ <DockPanel LastChildFill="True">
+ <Button Content="Load" Command="{Binding LoadCommand}" DockPanel.Dock="Right" />
+ <Grid></Grid>
+ </DockPanel>
</StackPanel>
</UserControl>

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -15,10 +15,15 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
private ObservableCollection<string> _wallets;
private string _selectedWallet;
+ private bool _isSelectedWallet;
public LoadWalletViewModel() : base("Load Wallet")
{
_wallets = new ObservableCollection<string>();
+ this.WhenAnyValue(x => x.SelectedWallet).Subscribe(SelectedWallet => IsSelectedWallet = !string.IsNullOrEmpty(SelectedWallet));
+ LoadCommand = ReactiveCommand.Create(
+ LoadWallet,
+ this.WhenAnyValue(x => x.IsSelectedWallet));
}
public ObservableCollection<string> Wallets
@@ -33,6 +38,12 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
set { this.RaiseAndSetIfChanged(ref _selectedWallet, value); }
}
+ public bool IsSelectedWallet
+ {
+ get { return _isSelectedWallet; }
+ set { this.RaiseAndSetIfChanged(ref _isSelectedWallet, value); }
+ }
+
public override void OnCategorySelected()
{
_wallets.Clear();
@@ -42,5 +53,21 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
_wallets.Add(Path.GetFileNameWithoutExtension(file));
}
}
+
+ public ReactiveCommand LoadCommand { get; }
+
+ public void LoadWallet()
+ {
+ var walletFullPath = Path.Combine(Global.WalletsDir, SelectedWallet + ".json");
+ if (!File.Exists(walletFullPath))
+ {
+ // the selected wallets is not available any more (someone deleted it)
+ OnCategorySelected();
+ SelectedWallet=null;
+ return;
+ }
+
+ // Implement the logic here
+ }
}
}

Add Load Button to the Load Wallet