Skip to content

Commit 04563fc

Browse files
Bug fix
1 parent 3941d4f commit 04563fc

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

YilmazturkThemeSelector.cs

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,36 +36,41 @@ public static class YilmazturkThemeSelector
3636
#region Trigger Code
3737
public static async void Apply(string theme,Control control)
3838
{
39-
if(theme == "light")
40-
{
41-
ApplyLightTheme(control);
42-
}
43-
else if(theme == "dark")
44-
{
45-
ApplyDarkTheme(control);
46-
}
47-
else if(theme == "system")
48-
{
49-
if(GetWindowsTheme() == "Default")
39+
try{
40+
if(theme == "light")
5041
{
5142
ApplyLightTheme(control);
5243
}
53-
else
44+
else if(theme == "dark")
5445
{
5546
ApplyDarkTheme(control);
5647
}
48+
else if(theme == "system")
49+
{
50+
if(GetWindowsTheme() == "Default")
51+
{
52+
ApplyLightTheme(control);
53+
}
54+
else
55+
{
56+
ApplyDarkTheme(control);
57+
}
58+
}
59+
else if (theme == "systemChange")
60+
{
61+
62+
controls = control;
63+
await tema(control);
64+
65+
66+
}
67+
else
68+
{
69+
ApplyAnotherTheme(control);
70+
}
5771
}
58-
else if (theme == "systemChange")
59-
{
60-
61-
controls = control;
62-
await tema(control);
63-
64-
65-
}
66-
else
67-
{
68-
ApplyAnotherTheme(control);
72+
catch{
73+
//linux users, windows 7 and older
6974
}
7075
}
7176
#endregion

0 commit comments

Comments
 (0)