mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Theme change fix
This commit is contained in:
@@ -28,7 +28,7 @@ namespace CustomControls
|
|||||||
[DllImport("DwmApi")] //System.Runtime.InteropServices
|
[DllImport("DwmApi")] //System.Runtime.InteropServices
|
||||||
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
|
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)
|
public static void InitColors(bool darkTheme)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -100,14 +100,16 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return;
|
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastTheme) < 2000) return;
|
||||||
lastTheme = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
|
||||||
|
|
||||||
switch (e.Category)
|
switch (e.Category)
|
||||||
{
|
{
|
||||||
case UserPreferenceCategory.General:
|
case UserPreferenceCategory.General:
|
||||||
Debug.WriteLine("Theme Changed");
|
bool changed = settingsForm.InitTheme();
|
||||||
Thread.Sleep(1000);
|
if (changed)
|
||||||
settingsForm.InitTheme();
|
{
|
||||||
|
Debug.WriteLine("Theme Changed");
|
||||||
|
lastTheme = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||||
|
}
|
||||||
|
|
||||||
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
|
if (settingsForm.fans is not null && settingsForm.fans.Text != "")
|
||||||
settingsForm.fans.InitTheme();
|
settingsForm.fans.InitTheme();
|
||||||
|
|||||||
Reference in New Issue
Block a user