Fixed Theme's not being applied correctly

Sometimes when switching themes it wouldn't apply the theme correctly.
This commit is contained in:
Heavy Bob 2025-04-07 09:20:13 +10:00
parent 5fc670b652
commit f116793591

View file

@ -99,7 +99,8 @@ public partial class HomePage : UserControl
return;
// Username
TrackREventDispatcher.PlayerLoginEvent += (username) => {
TrackREventDispatcher.PlayerLoginEvent += (username) =>
{
Dispatcher.Invoke(() =>
{
PilotNameTextBox.Text = username;
@ -109,7 +110,8 @@ public partial class HomePage : UserControl
};
// Ship
TrackREventDispatcher.JumpDriveStateChangedEvent += (shipName) => {
TrackREventDispatcher.JumpDriveStateChangedEvent += (shipName) =>
{
Dispatcher.Invoke(() =>
{
PlayerShipTextBox.Text = shipName;
@ -119,7 +121,8 @@ public partial class HomePage : UserControl
};
// Game Mode
TrackREventDispatcher.PlayerChangedGameModeEvent += (mode) => {
TrackREventDispatcher.PlayerChangedGameModeEvent += (mode) =>
{
Dispatcher.Invoke(() =>
{
GameModeTextBox.Text = mode.ToString();
@ -129,12 +132,14 @@ public partial class HomePage : UserControl
};
// Game Version
TrackREventDispatcher.GameVersionEvent += (version) => {
TrackREventDispatcher.GameVersionEvent += (version) =>
{
LocalPlayerData.GameVersion = version;
};
// Actor Death
TrackREventDispatcher.ActorDeathEvent += async (actorDeathData) => {
TrackREventDispatcher.ActorDeathEvent += async (actorDeathData) =>
{
if (actorDeathData.VictimPilot != LocalPlayerData.Username)
{
var playerData = await WebHandler.GetPlayerData(actorDeathData.VictimPilot);
@ -187,7 +192,8 @@ public partial class HomePage : UserControl
};
// Vehicle Destruction
TrackREventDispatcher.VehicleDestructionEvent += (data) => {
TrackREventDispatcher.VehicleDestructionEvent += (data) =>
{
LocalPlayerData.LastSeenVehicleLocation = data.VehicleZone;
};
@ -295,15 +301,13 @@ public partial class HomePage : UserControl
};
// Create a Border around the Image
var imageBorder = new Border
{
BorderBrush = accentColorBrush, // Set the border color
BorderThickness = new Thickness(2), // Set the border thickness
Padding = new Thickness(0), // Optional padding inside the border
CornerRadius = new CornerRadius(5),
Margin = new Thickness(10,18,15,18),
Child = profileImage // Set the Image as the content of the Border
};
var imageBorder = new Border();
imageBorder.SetResourceReference(Border.BorderBrushProperty, "AccentBrush");
imageBorder.BorderThickness = new Thickness(2);
imageBorder.Padding = new Thickness(0);
imageBorder.CornerRadius = new CornerRadius(5);
imageBorder.Margin = new Thickness(10, 18, 15, 18);
imageBorder.Child = profileImage;
// Add the Border (with the image inside) to the Grid
Grid.SetColumn(imageBorder, 1);