From 2ae473a02074e09fd66acbb0f821b5ae3ffe45b8 Mon Sep 17 00:00:00 2001 From: Aigio Liu Date: Tue, 27 Apr 2021 16:42:16 +0800 Subject: [PATCH] fix User Avater --- .../Application/UI/Views/MainView.axaml | 308 +++++++++--------- .../Services/Mvvm/UserService.cs | 5 +- 2 files changed, 157 insertions(+), 156 deletions(-) diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml index 396d45333..7bf847cf7 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/MainView.axaml @@ -15,165 +15,165 @@ FontFamily="{Binding Source={x:Static ms:UISettings.FontName},Path=Value, Mode=OneWay,Converter={StaticResource NameToFontFamilyConverter}}" x:DataType="vm:MainWindowViewModel" x:CompileBindings="True"> - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ST.Client.Desktop/Services/Mvvm/UserService.cs b/src/ST.Client.Desktop/Services/Mvvm/UserService.cs index 9c45aa5c9..31a4f5281 100644 --- a/src/ST.Client.Desktop/Services/Mvvm/UserService.cs +++ b/src/ST.Client.Desktop/Services/Mvvm/UserService.cs @@ -54,6 +54,7 @@ namespace System.Application.Services static string GetAvaterPath(UserInfoDTO? user) { + string? value = null; if (user is UserInfoDTO userInfo && userInfo.SteamAccountId.HasValue) { // Steam Avatar @@ -62,9 +63,9 @@ namespace System.Application.Services if (user is IUserDTO user2 && user2.Avatar.HasValue) { // Guid Avatar - return ImageUrlHelper.GetImageApiUrlById(user2.Avatar.Value); + value = ImageUrlHelper.GetImageApiUrlById(user2.Avatar.Value); } - return DefaultAvaterPath; + return value ?? DefaultAvaterPath; } const string DefaultAvaterPath = "avares://System.Application.SteamTools.Client.Desktop.Avalonia/Application/UI/Assets/AppResources/avater_default.png";