Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Merge main into feature/material-you-theme

KnifeLemon699c5a89a244
diff --cc src/Filee.App/Services/WindowService.cs
index ff97d265,3445db6d..3affae02
--- a/src/Filee.App/Services/WindowService.cs
+++ b/src/Filee.App/Services/WindowService.cs
@@@ -123,6 -123,39 +127,40 @@@ public sealed class WindowService(ILoca
MainShown?.Invoke(this, EventArgs.Empty);
}
+ private MainWindow CreateMain(string? page)
+ {
+ var model = ActivatorUtilities.CreateInstance<MainWindowViewModel>(services);
+ var main = new MainWindow { DataContext = model };
++ PrepareWindow(main);
+ if (_mainPlacement is { } placement)
+ {
+ placement.ApplyTo(main);
+ if (page is null)
+ model.Navigate(placement.Page);
+ }
+ main.Closing += (_, _) =>
+ {
+ // While it is still on screen: the release closes it hidden, when its position may no longer be known.
+ if (main.IsVisible)
+ _mainPlacement = MainWindowPlacement.Of(main, model, _mainPlacement);
+ };
+ main.Closed += (_, _) =>
+ {
+ _mains.Remove(main);
+ if (_main == main)
+ _main = null;
+ model.Dispose();
+ trimmer.Request();
+ };
+ _mains.Add(main);
+ return main;
+ }
+
+ // Every main window that isn't closed yet: normally just _main, plus one that is being released.
+ private readonly List<MainWindow> _mains = [];
+ private bool _openingMain;
+ private string? _openingMainPage;
+
/// <summary>Raised whenever <see cref="ShowMain"/> showed the main window (the user opened Filee).</summary>
public event EventHandler? MainShown;