diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 5bc4b6dfb..ec781ea8f 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -18,6 +18,7 @@ + diff --git a/src/Artemis.UI/Converters/EntryIconUriConverter.cs b/src/Artemis.UI/Converters/EntryIconUriConverter.cs new file mode 100644 index 000000000..eab7630ea --- /dev/null +++ b/src/Artemis.UI/Converters/EntryIconUriConverter.cs @@ -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; + } +} \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml index 8016a6b79..506c960d7 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml @@ -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"> - + RenderOptions.BitmapInterpolationMode="HighQuality" /> Artemis 2 @@ -52,17 +53,9 @@ - + - + @@ -81,17 +74,9 @@ - + - + @@ -110,17 +95,9 @@ - + - + @@ -139,17 +116,9 @@ - + - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs index 8fa53983e..883372aec 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabViewModel.cs @@ -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(); 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; } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntryListView.axaml b/src/Artemis.UI/Screens/Workshop/Entries/EntryListView.axaml index 3dce3c328..0c98ad6d0 100644 --- a/src/Artemis.UI/Screens/Workshop/Entries/EntryListView.axaml +++ b/src/Artemis.UI/Screens/Workshop/Entries/EntryListView.axaml @@ -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"> -