Update HomePage.xaml.cs

Implement fallback for profile image URL when primary URL is empty
This commit is contained in:
Koda-Dog 2025-01-31 16:09:22 +01:00
parent a92dbdfef1
commit 32935de85c

View file

@ -231,9 +231,10 @@ namespace AutoTrackR2
killGrid.Children.Add(killTextBlock);
// Create the Image for the profile
string urlToUse = string.IsNullOrEmpty(killParts[7]) ? "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg" : killParts[7];
var profileImage = new Image
{
Source = new BitmapImage(new Uri(killParts[7])), // Assuming the 8th part contains the profile image URL
Source = new BitmapImage(new Uri(urlToUse)), // Assuming the 8th part contains the profile image URL
Width = 90,
Height = 90,
Stretch = Stretch.Fill, // Adjust how the image fits
@ -357,9 +358,10 @@ namespace AutoTrackR2
killGrid.Children.Add(killTextBlock);
// Create the Image for the profile
string urlToUse = string.IsNullOrEmpty(killParts[7]) ? "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg" : killParts[7];
var profileImage = new Image
{
Source = new BitmapImage(new Uri(killParts[7])), // Assuming the 8th part contains the profile image URL
Source = new BitmapImage(new Uri(urlToUse)), // Assuming the 8th part contains the profile image URL
Width = 90,
Height = 90,
Stretch = Stretch.Fill, // Adjust how the image fits
@ -556,4 +558,4 @@ namespace AutoTrackR2
textBlock.FontSize = fontSize;
}
}
}
}