get icon from wallet file
MODIFY
WalletWasabi.Fluent/Controls/LoginControl.axaml
WalletWasabi.Fluent/Controls/LoginControl.axaml
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:c="using:WalletWasabi.Fluent.Controls">
+ xmlns:c="using:WalletWasabi.Fluent.Controls"
+ xmlns:conv="clr-namespace:WalletWasabi.Fluent.Converters">
<Style Selector="c|LoginControl">
<Setter Property="Template">
<ControlTemplate>
<!-- Icon -->
<Viewbox MaxHeight="200">
- <Image Source="/Assets/HardwareIcons/normal.png" />
+ <Image Source="{Binding SelectedWallet.Wallet.KeyManager, Converter={x:Static conv:WalletIconConverter.KeyManagerToImage}}" />
</Viewbox>
</DockPanel>

DELETE
WalletWasabi.Fluent/Converters/WalletTypeImageConverter.cs
-using Avalonia;
-using Avalonia.Data.Converters;
-using Avalonia.Media.Imaging;
-using Avalonia.Platform;
-using System;
-using System.Globalization;
-using WalletWasabi.Wallets;
-
-namespace WalletWasabi.Fluent.Converters
-{
- public class WalletTypeImageConverter : IValueConverter
- {
- public static readonly WalletTypeImageConverter Instance = new WalletTypeImageConverter();
-
- private WalletTypeImageConverter()
- {
- }
-
- object? IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is WalletType type)
- {
- Uri uri = new("avares://WalletWasabi.Fluent/Assets/HardwareIcons/generic.png");
-
- switch (type)
- {
- case WalletType.Coldcard:
- uri = new("avares://WalletWasabi.Fluent/Assets/HardwareIcons/coldcard.png");
- break;
-
- case WalletType.Trezor:
- uri = new("avares://WalletWasabi.Fluent/Assets/HardwareIcons/trezor.png");
- break;
-
- case WalletType.Ledger:
- uri = new("avares://WalletWasabi.Fluent/Assets/HardwareIcons/ledger.png");
- break;
-
- case WalletType.Normal:
- uri = new("avares://WalletWasabi.Fluent/Assets/HardwareIcons/normal.png");
- break;
- }
-
- var assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
-
- using var image = assets.Open(uri);
- return new Bitmap(image);
- }
-
- return null;
- }
-
- object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}

MODIFY
WalletWasabi.Fluent/ViewModels/Login/LoginViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Login/LoginViewModelBase.cs
using System.Reactive.Linq;
using System.Threading.Tasks;
using System.Windows.Input;
+using Avalonia;
+using Avalonia.Media.Imaging;
+using Avalonia.Platform;
using ReactiveUI;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.ViewModels.Navigation;
@@ -25,12 +28,12 @@ namespace WalletWasabi.Fluent.ViewModels.Login
this.WhenAnyValue(x => x.SelectedWallet)
.ObserveOn(RxApp.MainThreadScheduler)
- .Subscribe(wallet =>
+ .Subscribe(selectedWallet =>
{
- if (wallet is { })
+ if (selectedWallet is { })
{
Password = "";
- IsPasswordNeeded = !wallet.Wallet.KeyManager.IsWatchOnly;
+ IsPasswordNeeded = !selectedWallet.Wallet.KeyManager.IsWatchOnly;
}
});

MODIFY
WalletWasabi.Fluent/Views/AddWallet/AddedWalletPageView.axaml
WalletWasabi.Fluent/Views/AddWallet/AddedWalletPageView.axaml
<TextBlock Text=" was added to Wasabi." />
</StackPanel>
<Viewbox MaxHeight="200">
- <Image Source="{Binding Path='Type', Converter={x:Static conv:WalletTypeImageConverter.Instance}}" />
+ <Image Source="{Binding Type, Converter={x:Static conv:WalletIconConverter.WalletTypeToImage}}" />
</Viewbox>
</DockPanel>
</c:ContentArea>

MODIFY
WalletWasabi.Fluent/Views/AddWallet/HardwareWallet/DetectedHardwareWalletView.axaml
WalletWasabi.Fluent/Views/AddWallet/HardwareWallet/DetectedHardwareWalletView.axaml
</StackPanel>
<StackPanel VerticalAlignment="Center" Spacing="40">
- <Image Height="180" Source="{Binding Path='Type', Converter={x:Static conv:WalletTypeImageConverter.Instance}}" />
+ <Image Height="180" Source="{Binding Type, Converter={x:Static conv:WalletIconConverter.WalletTypeToImage}}" />
<TextBlock Text="{Binding TypeName, StringFormat={}{0} was detected. Is this correct?}" HorizontalAlignment="Center" />
</StackPanel>

MODIFY
WalletWasabi.Fluent/Views/Login/FullScreenLoginView.axaml
WalletWasabi.Fluent/Views/Login/FullScreenLoginView.axaml
</ComboBox.Resources>
<ComboBox.ItemTemplate>
<DataTemplate>
- <StackPanel Orientation="Horizontal">
- <Image Source="/Assets/HardwareIcons/ledger.png" Margin="0 0 10 0" Width="20" Height="20"/>
- <TextBlock Text="{Binding Wallet.WalletName}" VerticalAlignment="Center" />
+ <StackPanel DataContext="{Binding Wallet}" Orientation="Horizontal">
+ <Image Source="{Binding KeyManager, Converter={x:Static conv:WalletIconConverter.KeyManagerToImage}}" Margin="0 0 10 0" Width="20" Height="20"/>
+ <TextBlock Text="{Binding WalletName}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>

get icon from wallet file