ui: migrate client to gtk

This commit is contained in:
2025-06-17 09:40:10 +02:00
parent 0aa6ed98c6
commit 30b1832cd0
14 changed files with 664 additions and 2646 deletions

View File

@@ -1,22 +1,34 @@
using Pilz.UI.Telerik.Dialogs;
using Pilz.UI.Telerik.Symbols;
using Pilz.UI.Telerik.Theming;
using Telerik.WinControls;
using Telerik.WinControls.Themes;
using Microsoft.Win32;
using Pilz.UI.Gtk.Symbols;
using System.Runtime.InteropServices;
namespace ModpackUpdater.Apps;
public static class AppGlobals
{
public static IRadSymbolFactory<AppSymbols> Symbols { get; } = new AppSymbolFactory();
public static IGtkSymbolFactory<AppSymbols> Symbols { get; } = new AppSymbolFactory();
public static void Initialize()
{
ThemeHelper.ApplyApplicationTheme(ApplicationTheme.Auto,
() => new Windows11CompactTheme(),
() => new Windows11CompactDarkTheme());
RadFlyoutBase.ConfirmSvg = Symbols.GetSvgImage(AppSymbols.checkmark, Pilz.UI.Symbols.SymbolSize.Small);
RadFlyoutBase.CancelSvg = Symbols.GetSvgImage(AppSymbols.cancel, Pilz.UI.Symbols.SymbolSize.Small);
if (UsesWindowsDarkTheme())
Environment.SetEnvironmentVariable("GTK_THEME", "Adwaita:dark");
//RadFlyoutBase.ConfirmSvg = Symbols.GetSvgImage(AppSymbols.checkmark, Pilz.UI.Symbols.SymbolSize.Small);
//RadFlyoutBase.CancelSvg = Symbols.GetSvgImage(AppSymbols.cancel, Pilz.UI.Symbols.SymbolSize.Small);
}
private static bool UsesWindowsDarkTheme()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
try
{
return Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize")?.GetValue("AppsUseLightTheme") as bool? ?? default;
}
catch (Exception)
{
}
}
return default;
}
}