Theme change fix

This commit is contained in:
seerge
2023-04-07 13:37:00 +02:00
parent 13ec0f8911
commit 988c9e11dd
2 changed files with 7 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ namespace CustomControls
[DllImport("DwmApi")] //System.Runtime.InteropServices
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
public bool darkTheme;
public bool darkTheme = false;
public static void InitColors(bool darkTheme)
{

View File

@@ -100,14 +100,16 @@ namespace GHelper
{
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return;
lastTheme = DateTimeOffset.Now.ToUnixTimeMilliseconds();
switch (e.Category)
{
case UserPreferenceCategory.General:
Debug.WriteLine("Theme Changed");
Thread.Sleep(1000);
settingsForm.InitTheme();
bool changed = settingsForm.InitTheme();
if (changed)
{
Debug.WriteLine("Theme Changed");
lastTheme = DateTimeOffset.Now.ToUnixTimeMilliseconds();
}
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
settingsForm.fans.InitTheme();