implement separate icons for different wallet types.
ADD
WalletWasabi.Gui/Controls/WalletExplorer/ClosedHardwareWalletViewModel.cs
+using WalletWasabi.Wallets;
+
+namespace WalletWasabi.Gui.Controls.WalletExplorer
+{
+ public class ClosedHardwareWalletViewModel : ClosedWalletViewModel
+ {
+ internal ClosedHardwareWalletViewModel(Wallet wallet) : base(wallet)
+ {
+ }
+ }
+}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ClosedWalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ClosedWalletViewModel.cs
@@ -15,7 +15,23 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class ClosedWalletViewModel : WalletViewModelBase
{
- public ClosedWalletViewModel(Wallet wallet) : base(wallet)
+ public static WalletViewModelBase Create(Wallet wallet)
+ {
+ if (wallet.KeyManager.IsHardwareWallet)
+ {
+ return new ClosedHardwareWalletViewModel(wallet);
+ }
+ else if (wallet.KeyManager.IsWatchOnly)
+ {
+ return new ClosedWatchOnlyWalletViewModel(wallet);
+ }
+ else
+ {
+ return new ClosedWalletViewModel(wallet);
+ }
+ }
+
+ protected ClosedWalletViewModel(Wallet wallet) : base(wallet)
{
OpenWalletCommand = ReactiveCommand.CreateFromTask(async () =>
{

ADD
WalletWasabi.Gui/Controls/WalletExplorer/ClosedWatchOnlyWalletViewModel.cs
+using WalletWasabi.Wallets;
+
+namespace WalletWasabi.Gui.Controls.WalletExplorer
+{
+ public class ClosedWatchOnlyWalletViewModel : ClosedWalletViewModel
+ {
+ internal ClosedWatchOnlyWalletViewModel(Wallet wallet) : base(wallet)
+ {
+
+ }
+ }
+}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerView.xaml
</MenuItem>
</ContextMenu>
</StackPanel.ContextMenu>
+ <StackPanel.DataTemplates>
+ <DataTemplate DataType="ViewModels:ClosedHardwareWalletViewModel">
+ <DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_ClosedHardwareWallet}" />
+ </DataTemplate>
+ <DataTemplate DataType="ViewModels:ClosedWatchOnlyWalletViewModel">
+ <DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_WatchOnlyClosedWallet}" />
+ </DataTemplate>
+ <DataTemplate DataType="ViewModels:ClosedWalletViewModel">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_ClosedWallet}" />
+ </DataTemplate>
+ </StackPanel.DataTemplates>
+ <ContentControl Content="{Binding }" />
<TextBlock Text="{Binding Title}" />
<DrawingPresenter Name="PART_Spinner" Width="16" Height="16" IsVisible="{Binding WalletState, Converter={StaticResource WalletLoadingBoolConverter}}" Drawing="{DynamicResource WalletExplorer_Spinner}" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:WalletViewModel" ItemsSource="{Binding Actions}">
<StackPanel Classes="TreeViewRoot">
- <DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_OpenWallet}" />
- <TextBlock Text="{Binding Title}" />
- </StackPanel>
- </TreeDataTemplate>
- <TreeDataTemplate DataType="ViewModels:HardwareWalletViewModel" ItemsSource="{Binding Actions}">
- <StackPanel Classes="TreeViewRoot">
+ <StackPanel.DataTemplates>
+ <DataTemplate DataType="ViewModels:HardwareWalletViewModel">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_OpenHardwareWallet}" />
- <TextBlock Text="{Binding Title}" />
- </StackPanel>
- </TreeDataTemplate>
- <TreeDataTemplate DataType="ViewModels:WatchOnlyWalletViewModel" ItemsSource="{Binding Actions}">
- <StackPanel Classes="TreeViewRoot">
+ </DataTemplate>
+ <DataTemplate DataType="ViewModels:WatchOnlyWalletViewModel">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_WatchOnlyOpenWallet}" />
+ </DataTemplate>
+ <DataTemplate DataType="ViewModels:WalletViewModel">
+ <DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_OpenedWallet}" />
+ </DataTemplate>
+ </StackPanel.DataTemplates>
+ <ContentControl Content="{Binding }" />
<TextBlock Text="{Binding Title}" />
</StackPanel>
</TreeDataTemplate>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
@@ -71,8 +71,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
.Subscribe(wallet =>
{
WalletViewModelBase vm = (wallet.State <= WalletState.Starting) ?
- new ClosedWalletViewModel(wallet) :
- (WalletViewModelBase)new WalletViewModel(wallet);
+ ClosedWalletViewModel.Create(wallet) :
+ WalletViewModel.Create(wallet);
InsertWallet(vm);
});
@@ -190,22 +190,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
- private static WalletViewModel CreateWalletViewModel (Wallet wallet)
- {
- if(wallet.KeyManager.IsHardwareWallet)
- {
- return new HardwareWalletViewModel(wallet);
- }
- else if(wallet.KeyManager.IsWatchOnly)
- {
- return new WatchOnlyWalletViewModel(wallet);
- }
- else
- {
- return new WalletViewModel(wallet);
- }
- }
-
internal WalletViewModelBase OpenWallet(Wallet wallet)
{
if (_wallets.OfType<WalletViewModel>().Any(x => x.Title == wallet.WalletName))
@@ -213,7 +197,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
throw new Exception("Wallet already opened.");
}
- var walletViewModel = CreateWalletViewModel(wallet);
+ var walletViewModel = WalletViewModel.Create(wallet);
InsertWallet(walletViewModel);
@@ -239,7 +223,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
foreach (var wallet in WalletManager.GetWallets())
{
- InsertWallet(new ClosedWalletViewModel(wallet));
+ InsertWallet(ClosedWalletViewModel.Create(wallet));
}
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
@@ -20,7 +20,23 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
private ObservableCollection<ViewModelBase> _actions;
- public WalletViewModel(Wallet wallet) : base(wallet)
+ public static WalletViewModel Create(Wallet wallet)
+ {
+ if (wallet.KeyManager.IsHardwareWallet)
+ {
+ return new HardwareWalletViewModel(wallet);
+ }
+ else if (wallet.KeyManager.IsWatchOnly)
+ {
+ return new WatchOnlyWalletViewModel(wallet);
+ }
+ else
+ {
+ return new WalletViewModel(wallet);
+ }
+ }
+
+ protected WalletViewModel(Wallet wallet) : base(wallet)
{
Disposables = Disposables is null ? new CompositeDisposable() : throw new NotSupportedException($"Cannot open {GetType().Name} before closing it.");

implement separate icons for different wallet types.