1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 13:28:33 +00:00

About tab - Fixed my icon being smoll, lmao

About tab - Use async image loader instead of manual bitmaps
Workshop - Use async image loader for entry icons
This commit is contained in:
Robert 2023-08-24 19:38:47 +02:00
parent 2a34381926
commit e21edd0ed6
13 changed files with 75 additions and 223 deletions

View File

@ -18,6 +18,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AsyncImageLoader.Avalonia" Version="3.2.0" />
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Controls.PanAndZoom" Version="11.0.0" />
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />

View File

@ -0,0 +1,21 @@
using System;
using System.Globalization;
using Artemis.WebClient.Workshop;
using Avalonia.Data.Converters;
namespace Artemis.UI.Converters;
public class EntryIconUriConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is Guid guid)
return $"{WorkshopConstants.WORKSHOP_URL}/entries/{guid}/icon";
return value;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value;
}
}

View File

@ -5,20 +5,21 @@
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:vm="clr-namespace:Artemis.UI.Screens.Settings;assembly=Artemis.UI"
xmlns:il="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
x:DataType="vm:AboutTabViewModel"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1400"
x:Class="Artemis.UI.Screens.Settings.AboutTabView">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<StackPanel Margin="15" MaxWidth="800">
<Grid RowDefinitions="*,*" ColumnDefinitions="Auto,*,Auto">
<Image Grid.Column="0"
Grid.RowSpan="2"
<Image Grid.Column="0"
Grid.RowSpan="2"
Width="65"
Height="65"
VerticalAlignment="Center"
Source="/Assets/Images/Logo/bow.png"
Margin="0 0 20 0"
RenderOptions.BitmapInterpolationMode="HighQuality"/>
RenderOptions.BitmapInterpolationMode="HighQuality" />
<TextBlock Grid.Row="0" Grid.Column="1" FontSize="36" VerticalAlignment="Bottom">
Artemis 2
</TextBlock>
@ -52,17 +53,9 @@
<Border Classes="card" Margin="0 20 0 10">
<StackPanel>
<Grid RowDefinitions="*,*,*" ColumnDefinitions="Auto,*">
<Ellipse Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="3"
VerticalAlignment="Top"
Height="40"
Width="40"
Margin="0 0 15 0"
IsVisible="{CompiledBinding RobertProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
RenderOptions.BitmapInterpolationMode="HighQuality">
<Ellipse Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" VerticalAlignment="Top" Height="75" Width="75" Margin="0 0 15 0">
<Ellipse.Fill>
<ImageBrush Source="{CompiledBinding RobertProfileImage}" />
<ImageBrush il:ImageBrushLoader.Source="https://avatars.githubusercontent.com/u/8858506" />
</Ellipse.Fill>
</Ellipse>
<TextBlock Grid.Row="0" Grid.Column="1" Padding="0">
@ -81,17 +74,9 @@
<Border Classes="card-separator" />
<Grid RowDefinitions="*,*,*" ColumnDefinitions="Auto,*">
<Ellipse Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="3"
VerticalAlignment="Top"
Height="75"
Width="75"
Margin="0 0 15 0"
IsVisible="{CompiledBinding DarthAffeProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
RenderOptions.BitmapInterpolationMode="HighQuality">
<Ellipse Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" VerticalAlignment="Top" Height="75" Width="75" Margin="0 0 15 0">
<Ellipse.Fill>
<ImageBrush Source="{CompiledBinding DarthAffeProfileImage}" />
<ImageBrush il:ImageBrushLoader.Source="https://avatars.githubusercontent.com/u/1094841" />
</Ellipse.Fill>
</Ellipse>
<TextBlock Grid.Row="0" Grid.Column="1" Padding="0">
@ -110,17 +95,9 @@
<Border Classes="card-separator" />
<Grid RowDefinitions="*,*,*" ColumnDefinitions="Auto,*">
<Ellipse Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="3"
VerticalAlignment="Top"
Height="75"
Width="75"
Margin="0 0 15 0"
IsVisible="{CompiledBinding DrMeteorProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
RenderOptions.BitmapInterpolationMode="HighQuality">
<Ellipse Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" VerticalAlignment="Top" Height="75" Width="75" Margin="0 0 15 0">
<Ellipse.Fill>
<ImageBrush Source="{CompiledBinding DrMeteorProfileImage}" />
<ImageBrush il:ImageBrushLoader.Source="https://avatars.githubusercontent.com/u/29486064" />
</Ellipse.Fill>
</Ellipse>
<TextBlock Grid.Row="0" Grid.Column="1" Padding="0">
@ -139,17 +116,9 @@
<Border Classes="card-separator" />
<Grid RowDefinitions="*,*,*" ColumnDefinitions="Auto,*">
<Ellipse Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="3"
VerticalAlignment="Top"
Height="75"
Width="75"
Margin="0 0 15 0"
IsVisible="{CompiledBinding KaiProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
RenderOptions.BitmapInterpolationMode="HighQuality">
<Ellipse Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" VerticalAlignment="Top" Height="75" Width="75" Margin="0 0 15 0">
<Ellipse.Fill>
<ImageBrush Source="{CompiledBinding KaiProfileImage}" />
<ImageBrush il:ImageBrushLoader.Source="https://i.imgur.com/8mPWY1j.png" />
</Ellipse.Fill>
</Ellipse>
<TextBlock Grid.Row="0" Grid.Column="1" Padding="0">

View File

@ -1,75 +1,15 @@
using System;
using System.Reactive.Disposables;
using System.Reflection;
using System.Threading.Tasks;
using Artemis.Core;
using Artemis.Core;
using Artemis.UI.Shared;
using Avalonia.Media.Imaging;
using Flurl.Http;
using ReactiveUI;
namespace Artemis.UI.Screens.Settings;
public class AboutTabViewModel : ActivatableViewModelBase
{
private Bitmap? _darthAffeProfileImage;
private Bitmap? _drMeteorProfileImage;
private Bitmap? _kaiProfileImage;
private Bitmap? _robertProfileImage;
private string? _version;
public AboutTabViewModel()
{
DisplayName = "About";
this.WhenActivated((CompositeDisposable _) => Task.Run(Activate));
}
public string? Version
{
get => _version;
set => RaiseAndSetIfChanged(ref _version, value);
}
public Bitmap? RobertProfileImage
{
get => _robertProfileImage;
set => RaiseAndSetIfChanged(ref _robertProfileImage, value);
}
public Bitmap? DarthAffeProfileImage
{
get => _darthAffeProfileImage;
set => RaiseAndSetIfChanged(ref _darthAffeProfileImage, value);
}
public Bitmap? DrMeteorProfileImage
{
get => _drMeteorProfileImage;
set => RaiseAndSetIfChanged(ref _drMeteorProfileImage, value);
}
public Bitmap? KaiProfileImage
{
get => _kaiProfileImage;
set => RaiseAndSetIfChanged(ref _kaiProfileImage, value);
}
private async Task Activate()
{
AssemblyInformationalVersionAttribute? versionAttribute = typeof(AboutTabViewModel).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
Version = $"Version {Constants.CurrentVersion}";
try
{
RobertProfileImage = new Bitmap(await "https://avatars.githubusercontent.com/u/8858506".GetStreamAsync());
RobertProfileImage = new Bitmap(await "https://avatars.githubusercontent.com/u/8858506".GetStreamAsync());
DarthAffeProfileImage = new Bitmap(await "https://avatars.githubusercontent.com/u/1094841".GetStreamAsync());
DrMeteorProfileImage = new Bitmap(await "https://avatars.githubusercontent.com/u/29486064".GetStreamAsync());
KaiProfileImage = new Bitmap(await "https://i.imgur.com/8mPWY1j.png".GetStreamAsync());
}
catch (Exception)
{
// ignored, unluckyyyy
}
}
public string Version { get; }
}

View File

@ -3,17 +3,21 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:entries="clr-namespace:Artemis.UI.Screens.Workshop.Profile"
xmlns:entries1="clr-namespace:Artemis.UI.Screens.Workshop.Entries"
xmlns:il="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="110"
x:Class="Artemis.UI.Screens.Workshop.Entries.EntryListView"
x:DataType="entries1:EntryListViewModel">
<Button MinHeight="110"
MaxHeight="140"
<UserControl.Resources>
<converters:EntryIconUriConverter x:Key="EntryIconUriConverter" />
</UserControl.Resources>
<Button MinHeight="110"
MaxHeight="140"
Padding="16"
CornerRadius="8"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Command="{CompiledBinding NavigateToEntry}"
IsVisible="{CompiledBinding Entry, Converter={x:Static ObjectConverters.IsNotNull}}">
<Grid ColumnDefinitions="Auto,*,Auto">
@ -26,24 +30,22 @@
Width="80"
Height="80"
ClipToBounds="True">
<Image Source="{CompiledBinding EntryIcon}"
Stretch="UniformToFill"
Classes="fade-in"
Classes.faded-in="{CompiledBinding EntryIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Image Stretch="UniformToFill" il:ImageLoader.Source="{CompiledBinding Entry.Id, Converter={StaticResource EntryIconUriConverter}, Mode=OneWay}" />
</Border>
<!-- Body -->
<Grid Grid.Column="1" VerticalAlignment="Stretch" RowDefinitions="Auto,*,Auto">
<TextBlock Grid.Row="0" Margin="0 0 0 5" TextTrimming="CharacterEllipsis" >
<TextBlock Grid.Row="0" Margin="0 0 0 5" TextTrimming="CharacterEllipsis">
<Run Classes="h5" Text="{CompiledBinding Entry.Name, FallbackValue=Title}" />
<Run Classes="subtitle">by</Run>
<Run Classes="subtitle" Text="{CompiledBinding Entry.Author, FallbackValue=Author}" />
</TextBlock>
<TextBlock Grid.Row="1"
Classes="subtitle"
<TextBlock Grid.Row="1"
Classes="subtitle"
TextWrapping="Wrap"
TextTrimming="CharacterEllipsis"
Text="{CompiledBinding Entry.Summary, FallbackValue=Summary}"></TextBlock>
TextTrimming="CharacterEllipsis"
Text="{CompiledBinding Entry.Summary, FallbackValue=Summary}">
</TextBlock>
<ItemsControl Grid.Row="2" ItemsSource="{CompiledBinding Entry.Categories}">
<ItemsControl.ItemsPanel>
@ -61,7 +63,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
<!-- Info -->
<StackPanel Grid.Column="2">
<TextBlock TextAlignment="Right" Text="{CompiledBinding Entry.CreatedAt, StringFormat={}{0:g}, FallbackValue=01-01-1337}" />

View File

@ -16,26 +16,16 @@ namespace Artemis.UI.Screens.Workshop.Entries;
public class EntryListViewModel : ActivatableViewModelBase
{
private readonly IRouter _router;
private readonly IWorkshopService _workshopService;
private ObservableAsPropertyHelper<Bitmap?>? _entryIcon;
public EntryListViewModel(IGetEntries_Entries_Items entry, IRouter router, IWorkshopService workshopService)
public EntryListViewModel(IGetEntries_Entries_Items entry, IRouter router)
{
_router = router;
_workshopService = workshopService;
Entry = entry;
NavigateToEntry = ReactiveCommand.CreateFromTask(ExecuteNavigateToEntry);
this.WhenActivated(d =>
{
_entryIcon = Observable.FromAsync(GetIcon).ToProperty(this, vm => vm.EntryIcon);
_entryIcon.DisposeWith(d);
});
}
public IGetEntries_Entries_Items Entry { get; }
public Bitmap? EntryIcon => _entryIcon?.Value;
public ReactiveCommand<Unit, Unit> NavigateToEntry { get; }
private async Task ExecuteNavigateToEntry()
@ -54,12 +44,4 @@ public class EntryListViewModel : ActivatableViewModelBase
throw new ArgumentOutOfRangeException();
}
}
private async Task<Bitmap?> GetIcon(CancellationToken cancellationToken)
{
// Take at least 100ms to allow the UI to load and make the whole thing smooth
Task<Bitmap?> iconTask = _workshopService.GetEntryIcon(Entry.Id, cancellationToken);
await Task.Delay(100, cancellationToken);
return await iconTask;
}
}

View File

@ -4,9 +4,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:profile="clr-namespace:Artemis.UI.Screens.Workshop.Profile"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:il="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Workshop.Profile.ProfileDetailsView"
x:DataType="profile:ProfileDetailsViewModel">
<UserControl.Resources>
<converters:EntryIconUriConverter x:Key="EntryIconUriConverter" />
</UserControl.Resources>
<Border Classes="router-container">
<Grid ColumnDefinitions="300,*" RowDefinitions="Auto,*" Margin="10">
<Border Classes="card" Grid.Row="1" Grid.Column="0" Margin="0 0 10 0">
@ -18,10 +23,7 @@
Width="80"
Height="80"
ClipToBounds="True">
<Image Source="{CompiledBinding EntryIcon}"
Stretch="UniformToFill"
Classes="fade-in"
Classes.faded-in="{CompiledBinding EntryIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Image Stretch="UniformToFill" il:ImageLoader.Source="{CompiledBinding Entry.Id, Converter={StaticResource EntryIconUriConverter}, Mode=OneWay}" />
</Border>
<TextBlock Theme="{StaticResource TitleTextBlockStyle}"

View File

@ -5,7 +5,6 @@ using Artemis.UI.Screens.Workshop.Parameters;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Routing;
using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Services;
using Avalonia.Media.Imaging;
using StrawberryShake;
@ -14,14 +13,12 @@ namespace Artemis.UI.Screens.Workshop.Profile;
public class ProfileDetailsViewModel : RoutableScreen<ActivatableViewModelBase, WorkshopDetailParameters>, IWorkshopViewModel
{
private readonly IWorkshopClient _client;
private readonly IWorkshopService _workshopService;
private IGetEntryById_Entry? _entry;
private Bitmap? _entryIcon;
public ProfileDetailsViewModel(IWorkshopClient client, IWorkshopService workshopService)
public ProfileDetailsViewModel(IWorkshopClient client)
{
_client = client;
_workshopService = workshopService;
}
public EntryType? EntryType => null;
@ -29,13 +26,7 @@ public class ProfileDetailsViewModel : RoutableScreen<ActivatableViewModelBase,
public IGetEntryById_Entry? Entry
{
get => _entry;
set => RaiseAndSetIfChanged(ref _entry, value);
}
public Bitmap? EntryIcon
{
get => _entryIcon;
set => RaiseAndSetIfChanged(ref _entryIcon, value);
private set => RaiseAndSetIfChanged(ref _entry, value);
}
public override async Task OnNavigating(WorkshopDetailParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
@ -48,11 +39,7 @@ public class ProfileDetailsViewModel : RoutableScreen<ActivatableViewModelBase,
IOperationResult<IGetEntryByIdResult> result = await _client.GetEntryById.ExecuteAsync(entryId, cancellationToken);
if (result.IsErrorResult())
return;
Bitmap? oldEntryIcon = EntryIcon;
Entry = result.Data?.Entry;
EntryIcon = await _workshopService.GetEntryIcon(entryId, cancellationToken);
oldEntryIcon?.Dispose();
}
}

View File

@ -3,9 +3,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:search="clr-namespace:Artemis.UI.Screens.Workshop.Search"
xmlns:il="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="80"
x:Class="Artemis.UI.Screens.Workshop.Search.SearchResultView"
x:DataType="search:SearchResultViewModel">
<UserControl.Resources>
<converters:EntryIconUriConverter x:Key="EntryIconUriConverter" />
</UserControl.Resources>
<Grid ColumnDefinitions="Auto,*,Auto" Margin="0 5">
<!-- Icon -->
<Border Grid.Column="0"
@ -16,16 +21,13 @@
Width="50"
Height="50"
ClipToBounds="True">
<Image Source="{CompiledBinding EntryIcon}"
Stretch="UniformToFill"
Classes="fade-in"
Classes.faded-in="{CompiledBinding EntryIcon, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Image Stretch="UniformToFill" il:ImageLoader.Source="{CompiledBinding Entry.Id, Converter={StaticResource EntryIconUriConverter}, Mode=OneWay}" />
</Border>
<!-- Body -->
<Grid Grid.Column="1" VerticalAlignment="Stretch" RowDefinitions="Auto,*,Auto">
<TextBlock Grid.Row="0" TextTrimming="CharacterEllipsis">
<Run Text="{CompiledBinding Entry.Name, FallbackValue=Title}" />
<Run Text="{CompiledBinding Entry.Name, FallbackValue=Title}" />
<Run Classes="subtitle" FontSize="12">by</Run>
<Run Classes="subtitle" FontSize="12" Text="{CompiledBinding Entry.Author, FallbackValue=Author}" />
</TextBlock>

View File

@ -1,32 +1,14 @@
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using Artemis.UI.Shared;
using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Services;
using Avalonia.Media.Imaging;
using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Search;
public class SearchResultViewModel : ActivatableViewModelBase
{
private readonly IWorkshopService _workshopService;
private ObservableAsPropertyHelper<Bitmap?>? _entryIcon;
public SearchResultViewModel(ISearchEntries_SearchEntries entry, IWorkshopService workshopService)
public SearchResultViewModel(ISearchEntries_SearchEntries entry)
{
_workshopService = workshopService;
Entry = entry;
this.WhenActivated(d =>
{
_entryIcon = Observable.FromAsync(c => _workshopService.GetEntryIcon(Entry.Id, c)).ToProperty(this, vm => vm.EntryIcon);
_entryIcon.DisposeWith(d);
});
}
public ISearchEntries_SearchEntries Entry { get; }
public Bitmap? EntryIcon => _entryIcon?.Value;
}

View File

@ -19,16 +19,14 @@ public class SearchViewModel : ViewModelBase
private readonly ILogger _logger;
private readonly IRouter _router;
private readonly IWorkshopClient _workshopClient;
private readonly IWorkshopService _workshopService;
private EntryType? _entryType;
private bool _isLoading;
private SearchResultViewModel? _selectedEntry;
public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IWorkshopService workshopService, IRouter router, CurrentUserViewModel currentUserViewModel)
public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IRouter router, CurrentUserViewModel currentUserViewModel)
{
_logger = logger;
_workshopClient = workshopClient;
_workshopService = workshopService;
_router = router;
CurrentUserViewModel = currentUserViewModel;
SearchAsync = ExecuteSearchAsync;
@ -79,7 +77,7 @@ public class SearchViewModel : ViewModelBase
IsLoading = true;
IOperationResult<ISearchEntriesResult> results = await _workshopClient.SearchEntries.ExecuteAsync(input, EntryType, cancellationToken);
return results.Data?.SearchEntries.Select(e => new SearchResultViewModel(e, _workshopService) as object) ?? new List<object>();
return results.Data?.SearchEntries.Select(e => new SearchResultViewModel(e) as object) ?? new List<object>();
}
catch (Exception e)
{

View File

@ -8,6 +8,7 @@
<!-- <FluentTheme Mode="Dark"></FluentTheme> -->
<StyleInclude Source="avares://Artemis.UI.Shared/Styles/Artemis.axaml" />
<StyleInclude Source="avares://AsyncImageLoader.Avalonia/AdvancedImage.axaml" />
<Styles.Resources>
<ResourceDictionary>

View File

@ -23,40 +23,6 @@ public class WorkshopService : IWorkshopService
});
}
/// <inheritdoc />
public async Task<Bitmap?> GetEntryIcon(Guid entryId, CancellationToken cancellationToken)
{
await _iconCacheLock.WaitAsync(cancellationToken);
try
{
if (_entryIconCache.TryGetValue(entryId, out Stream? cachedBitmap))
{
cachedBitmap.Seek(0, SeekOrigin.Begin);
return new Bitmap(cachedBitmap);
}
}
finally
{
_iconCacheLock.Release();
}
HttpClient client = _httpClientFactory.CreateClient(WorkshopConstants.WORKSHOP_CLIENT_NAME);
try
{
HttpResponseMessage response = await client.GetAsync($"entries/{entryId}/icon", cancellationToken);
response.EnsureSuccessStatusCode();
Stream data = await response.Content.ReadAsStreamAsync(cancellationToken);
_entryIconCache[entryId] = data;
return new Bitmap(data);
}
catch (HttpRequestException)
{
// ignored
return null;
}
}
public async Task<ImageUploadResult> SetEntryIcon(Guid entryId, Progress<StreamProgress> progress, Stream icon, CancellationToken cancellationToken)
{
icon.Seek(0, SeekOrigin.Begin);
@ -96,6 +62,5 @@ public class WorkshopService : IWorkshopService
public interface IWorkshopService
{
Task<Bitmap?> GetEntryIcon(Guid entryId, CancellationToken cancellationToken);
Task<ImageUploadResult> SetEntryIcon(Guid entryId, Progress<StreamProgress> progress, Stream icon, CancellationToken cancellationToken);
}