Actually cancer to read. Addresses the issue of the theme color not being assigned for themes correctly.
This commit is contained in:
Heavy Bob 2025-04-09 06:40:14 +10:00
parent ab6b95a281
commit 1f35e0a9e6

View file

@ -233,67 +233,51 @@ public partial class HomePage : UserControl
private void AddKillToScreen(KillData killData) private void AddKillToScreen(KillData killData)
{ {
// Fetch the dynamic resource for AltTextColor // Use resource references instead of creating new brushes
var altTextColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AltTextColor"]);
var accentColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AccentColor"]);
// Fetch the Orbitron FontFamily from resources
var orbitronFontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
var gemunuFontFamily = (FontFamily)Application.Current.Resources["Gemunu"];
// Create a new TextBlock for each kill
var killTextBlock = new TextBlock var killTextBlock = new TextBlock
{ {
Margin = new Thickness(0, 10, 0, 10), Margin = new Thickness(0, 10, 0, 10),
Style = (Style)Application.Current.Resources["RoundedTextBlock"], // Apply style for text Style = (Style)Application.Current.Resources["RoundedTextBlock"],
FontSize = 14, FontSize = 14,
FontWeight = FontWeights.Bold, FontWeight = FontWeights.Bold,
FontFamily = gemunuFontFamily, FontFamily = (FontFamily)Application.Current.Resources["Gemunu"],
}; };
// Add styled content using Run elements // Add styled content using Run elements with resource references
killTextBlock.Inlines.Add(new Run("Victim Name: ") var titleRun = new Run("Victim Name: ");
{ titleRun.SetResourceReference(TextElement.ForegroundProperty, "AltTextBrush");
Foreground = altTextColorBrush, titleRun.FontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
FontFamily = orbitronFontFamily, killTextBlock.Inlines.Add(titleRun);
});
killTextBlock.Inlines.Add(new Run($"{killData.EnemyPilot}\n")); killTextBlock.Inlines.Add(new Run($"{killData.EnemyPilot}\n"));
// Repeat for other lines titleRun = new Run("Victim Ship: ");
killTextBlock.Inlines.Add(new Run("Victim Ship: ") titleRun.SetResourceReference(TextElement.ForegroundProperty, "AltTextBrush");
{ titleRun.FontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
Foreground = altTextColorBrush, killTextBlock.Inlines.Add(titleRun);
FontFamily = orbitronFontFamily,
});
killTextBlock.Inlines.Add(new Run($"{killData.EnemyShip}\n")); killTextBlock.Inlines.Add(new Run($"{killData.EnemyShip}\n"));
killTextBlock.Inlines.Add(new Run("Victim Org: ") titleRun = new Run("Victim Org: ");
{ titleRun.SetResourceReference(TextElement.ForegroundProperty, "AltTextBrush");
Foreground = altTextColorBrush, titleRun.FontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
FontFamily = orbitronFontFamily, killTextBlock.Inlines.Add(titleRun);
});
killTextBlock.Inlines.Add(new Run($"{killData.OrgAffiliation}\n")); killTextBlock.Inlines.Add(new Run($"{killData.OrgAffiliation}\n"));
killTextBlock.Inlines.Add(new Run("Join Date: ") titleRun = new Run("Join Date: ");
{ titleRun.SetResourceReference(TextElement.ForegroundProperty, "AltTextBrush");
Foreground = altTextColorBrush, titleRun.FontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
FontFamily = orbitronFontFamily, killTextBlock.Inlines.Add(titleRun);
});
killTextBlock.Inlines.Add(new Run($"{killData.Enlisted}\n")); killTextBlock.Inlines.Add(new Run($"{killData.Enlisted}\n"));
killTextBlock.Inlines.Add(new Run("UEE Record: ") titleRun = new Run("UEE Record: ");
{ titleRun.SetResourceReference(TextElement.ForegroundProperty, "AltTextBrush");
Foreground = altTextColorBrush, titleRun.FontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
FontFamily = orbitronFontFamily, killTextBlock.Inlines.Add(titleRun);
});
killTextBlock.Inlines.Add(new Run($"{killData.RecordNumber}\n")); killTextBlock.Inlines.Add(new Run($"{killData.RecordNumber}\n"));
killTextBlock.Inlines.Add(new Run("Kill Time: ") titleRun = new Run("Kill Time: ");
{ titleRun.SetResourceReference(TextElement.ForegroundProperty, "AltTextBrush");
Foreground = altTextColorBrush, titleRun.FontFamily = (FontFamily)Application.Current.Resources["Orbitron"];
FontFamily = orbitronFontFamily, killTextBlock.Inlines.Add(titleRun);
});
killTextBlock.Inlines.Add(new Run($"{killData.KillTime}")); killTextBlock.Inlines.Add(new Run($"{killData.KillTime}"));
// Create a Border and apply the RoundedTextBlockWithBorder style // Create a Border and apply the RoundedTextBlockWithBorder style