Theme slider is now defined by the max themes available.

Also added the DMC theme too.
This commit is contained in:
Heavy Bob 2025-04-07 23:02:55 +10:00
parent eb50d878b4
commit 769d46df9d
5 changed files with 347 additions and 328 deletions

BIN
AutoTrackR2/Assets/DMC.png Normal file

Binary file not shown.

After

(image error) Size: 385 KiB

View file

@ -30,6 +30,7 @@
<None Remove="Assets\VOX.png" />
<None Remove="Assets\WRITH.png" />
<None Remove="Assets\ZAP.png" />
<None Remove="Assets\DMC.png" />
<None Remove="config.ini" />
<None Remove="Fonts\Orbitron-Bold.ttf" />
<None Remove="Fonts\Roboto-Regular.ttf" />
@ -100,9 +101,6 @@
<Resource Include="Assets\VOX.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\WRITH.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\cinderborn.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
@ -112,6 +110,9 @@
<Resource Include="Assets\ZAP.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\DMC.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="config.ini" />
<Resource Include="Fonts\Orbitron-Bold.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

View file

@ -207,7 +207,6 @@
Margin="0,7,0,5"/>
<Slider x:Name="ThemeSlider"
Minimum="0"
Maximum="24"
Value="0"
TickFrequency="1"
IsSnapToTickEnabled="True"

View file

@ -43,6 +43,12 @@ public partial class ConfigPage : UserControl
const string themeJsonPath = "themes.json";
var themeJson = File.ReadAllText(themeJsonPath);
_themes = JsonSerializer.Deserialize<Dictionary<string, Theme>>(themeJson);
// Set the theme slider's maximum value based on the number of themes
if (_themes != null)
{
ThemeSlider.Maximum = _themes.Count - 1;
}
}
// Method to change the logo image in MainWindow
@ -139,7 +145,7 @@ public partial class ConfigPage : UserControl
{
ChangeLogo(theme.Logo.Path,
theme.Logo.Primary != null
? (Color) ColorConverter.ConvertFromString(theme.Logo.Primary)
? (Color)ColorConverter.ConvertFromString(theme.Logo.Primary)
: Colors.Transparent);
}

View file

@ -317,5 +317,18 @@
"Path": "/Assets/ZAP.png",
"Primary": "#FFD700"
}
},
"DMC": {
"Colors": {
"Accent": "#FF0000",
"Button": "#1A0000",
"Background": "#0A0000",
"Text": "#FFFFFF",
"AltText": "#FF3333"
},
"Logo": {
"Path": "/Assets/DMC.png",
"Primary": "#FF0000"
}
}
}