mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Cleanup of WinformThemer
This commit is contained in:
+40
-17
@@ -29,11 +29,7 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
forms.Add(form);
|
forms.Add(form);
|
||||||
}
|
}
|
||||||
|
SetThemeToGlobal(forms);
|
||||||
foreach (Form form in forms)
|
|
||||||
{
|
|
||||||
SetThemeToGlobal(form);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -43,27 +39,35 @@ namespace VRCX
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static int GetGlobalTheme() => currentTheme;
|
public static int GetGlobalTheme() => currentTheme;
|
||||||
|
|
||||||
|
|
||||||
public static void SetThemeToGlobal(Form form)
|
public static void SetThemeToGlobal(Form form)
|
||||||
{
|
{
|
||||||
SetThemeToGlobal(form.Handle);
|
SetThemeToGlobal(new List<Form>() { form });
|
||||||
|
}
|
||||||
|
|
||||||
InvisPopup thisJankThing = new InvisPopup();
|
public static void SetThemeToGlobal(List<Form> forms)
|
||||||
thisJankThing.Show();
|
{
|
||||||
|
InvisPopupHandler.Show();
|
||||||
|
|
||||||
if (form.WindowState != FormWindowState.Minimized)
|
foreach(Form form in forms)
|
||||||
{
|
{
|
||||||
//attempting to refresh this god forsaken title bar
|
SetThemeToGlobal(form.Handle);
|
||||||
|
|
||||||
//Minimize, Downside: shows animation
|
if (form.WindowState != FormWindowState.Minimized)
|
||||||
//PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_MINIMIZE);
|
{
|
||||||
//PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_RESTORE);
|
//attempting to refresh this god forsaken title bar
|
||||||
|
|
||||||
//Hide, Downside: reorders window to last in taskbar if not pinned
|
//Minimize, Downside: shows animation
|
||||||
PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_HIDE);
|
//PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_MINIMIZE);
|
||||||
PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_SHOW);
|
//PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_RESTORE);
|
||||||
|
|
||||||
|
//Hide, Downside: reorders window to last in taskbar if not pinned
|
||||||
|
PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_HIDE);
|
||||||
|
PInvokeFun.ShowWindow(form.Handle, (int)PInvokeFun.SW_TYPES.SW_SHOW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thisJankThing.Close();
|
InvisPopupHandler.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetThemeToGlobal(IntPtr handle)
|
private static void SetThemeToGlobal(IntPtr handle)
|
||||||
@@ -93,6 +97,25 @@ namespace VRCX
|
|||||||
return theme;
|
return theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static class InvisPopupHandler
|
||||||
|
{
|
||||||
|
private static InvisPopup instance;
|
||||||
|
|
||||||
|
internal static void Show()
|
||||||
|
{
|
||||||
|
if(instance == null)
|
||||||
|
instance = new InvisPopup();
|
||||||
|
instance.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void Close()
|
||||||
|
{
|
||||||
|
instance.Close();
|
||||||
|
instance.Dispose();
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static class PInvokeFun
|
internal static class PInvokeFun
|
||||||
{
|
{
|
||||||
[DllImport("DwmApi")]
|
[DllImport("DwmApi")]
|
||||||
|
|||||||
Reference in New Issue
Block a user