Fix first load issue

This commit is contained in:
DB p 2025-02-24 15:16:11 +09:00
parent 270f5b3ca0
commit 53cb94dc60
2 changed files with 14 additions and 1 deletions

View file

@ -108,7 +108,12 @@ namespace Flow.Launcher.Core.Resource
public void RefreshFrame()
{
IntPtr mainWindowPtr = new WindowInteropHelper(mainWindow).Handle;
if (mainWindowPtr == IntPtr.Zero)
return;
HwndSource mainWindowSrc = HwndSource.FromHwnd(mainWindowPtr);
if (mainWindowSrc == null)
return;
//mainWindowSrc.CompositionTarget.BackgroundColor = Color.FromArgb(0, 255, 181, 178);
ParameterTypes.MARGINS margins = new ParameterTypes.MARGINS();
@ -136,7 +141,12 @@ namespace Flow.Launcher.Core.Resource
//SetWindowAccent();
var dict = GetThemeResourceDictionary(Settings.Theme);
if (dict == null)
return;
var windowBorderStyle = dict["WindowBorderStyle"] as Style;
if (windowBorderStyle == null)
return;
Methods.SetWindowAttribute(new WindowInteropHelper(mainWindow).Handle, DWMWINDOWATTRIBUTE.DWMWA_SYSTEMBACKDROP_TYPE, 3);
if (BlurEnabled)
{

View file

@ -181,7 +181,10 @@ namespace Flow.Launcher
private void OnLoaded(object sender, RoutedEventArgs _)
{
ThemeManager.Instance.RefreshFrame();
Dispatcher.BeginInvoke((Action)(() =>
{
ThemeManager.Instance.RefreshFrame();
}), DispatcherPriority.Background);
// MouseEventHandler
PreviewMouseMove += MainPreviewMouseMove;