Fixed some dependancy issues, added prelogo and adjusted init and mainwindow display to load AFTER osquery finishes it's scan.

This commit is contained in:
2025-11-04 13:01:17 +08:00
parent dce789db94
commit aacd8e0293
13 changed files with 71 additions and 76 deletions

View File

@@ -16,18 +16,47 @@ public partial class App : Application
[STAThread]
private static void Main(string[] args)
{
MainAsync(args).GetAwaiter().GetResult();
// Show splash screen with fade-in effect
var splash = new SplashScreen("Assets/splash.png");
splash.Show(false, true); // autoClose=false, topMost=true
// Allow 1 second for fade-in to complete
System.Threading.Thread.Sleep(1000);
MainAsync(args, splash).GetAwaiter().GetResult();
}
private static async Task MainAsync(string[] args)
private static async Task MainAsync(string[] args, SplashScreen splash)
{
using IHost host = CreateHostBuilder(args).Build();
await host.StartAsync().ConfigureAwait(true);
App app = new();
app.InitializeComponent();
app.MainWindow = host.Services.GetRequiredService<MainWindow>();
app.MainWindow.Visibility = Visibility.Visible;
var mainWindow = host.Services.GetRequiredService<MainWindow>();
app.MainWindow = mainWindow;
// Keep MainWindow hidden until system info loads
mainWindow.Visibility = Visibility.Hidden;
// When system info finishes loading, show MainWindow and close splash
mainWindow.SystemInfoLoaded += (s, e) =>
{
// Use dispatcher to handle UI thread timing
mainWindow.Dispatcher.BeginInvoke(async () =>
{
// Wait 1 second before starting fade-out
await Task.Delay(1000);
// Show the main window
mainWindow.Visibility = Visibility.Visible;
// Close splash with fade-out effect (1 second)
splash.Close(TimeSpan.FromMilliseconds(1000));
});
};
app.Run();
await host.StopAsync().ConfigureAwait(true);