From e7ecc6903f18b1a13b5bf8adf9d070dbc72b3264 Mon Sep 17 00:00:00 2001 From: Simon G Date: Mon, 26 Apr 2021 14:34:24 +0200 Subject: [PATCH] - show icon of mapped controllable --- Mystify/Mystify.csproj | 1 + Mystify/Resources/ChannelTemplate.axaml | 2 +- Mystify/ViewModels/ControllableViewModel.cs | 6 +++++- Mystify/Views/ControllableSelectionWindow.axaml | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Mystify/Mystify.csproj b/Mystify/Mystify.csproj index cfbf69e..da7d086 100644 --- a/Mystify/Mystify.csproj +++ b/Mystify/Mystify.csproj @@ -23,6 +23,7 @@ + diff --git a/Mystify/Resources/ChannelTemplate.axaml b/Mystify/Resources/ChannelTemplate.axaml index afbdfe1..173b8da 100644 --- a/Mystify/Resources/ChannelTemplate.axaml +++ b/Mystify/Resources/ChannelTemplate.axaml @@ -12,7 +12,7 @@ - + diff --git a/Mystify/ViewModels/ControllableViewModel.cs b/Mystify/ViewModels/ControllableViewModel.cs index 2a540c9..592679a 100644 --- a/Mystify/ViewModels/ControllableViewModel.cs +++ b/Mystify/ViewModels/ControllableViewModel.cs @@ -4,7 +4,9 @@ using System; using System.Windows.Input; +using Avalonia.Media.Imaging; using Lib.Audio.Interfaces; +using Lib.Tools.Avalonia; using ReactiveUI; namespace Mystify.ViewModels @@ -12,12 +14,14 @@ namespace Mystify.ViewModels public class ControllableViewModel : ViewModelBase { private bool _isSelected; + private Bitmap? _icon; public ControllableViewModel(IControllable controllable) => Controllable = controllable; public IControllable Controllable { get; } public string Name => Controllable.Name; - public string? IconPath => Controllable.IconPath; + public Bitmap? Icon => string.IsNullOrEmpty(Controllable.ExecutablePath) ? null + : _icon ??= Icons.ExtractAssociatedIcon(Controllable.ExecutablePath); public bool IsSelected { diff --git a/Mystify/Views/ControllableSelectionWindow.axaml b/Mystify/Views/ControllableSelectionWindow.axaml index 5343714..63c5e33 100644 --- a/Mystify/Views/ControllableSelectionWindow.axaml +++ b/Mystify/Views/ControllableSelectionWindow.axaml @@ -23,7 +23,7 @@