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