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

@@ -51,6 +51,9 @@ namespace LD_SysInfo
private static readonly string ConfigPath = Path.Combine(AppContext.BaseDirectory, "config.json");
// Event to signal when system info loading is complete
public event EventHandler? SystemInfoLoaded;
public MainWindow()
{
@@ -78,7 +81,10 @@ namespace LD_SysInfo
VersionTextBlock.Text = "v0.0.0";
}
LoadConfig();
DisplaySystemInfo();
// Load system info asynchronously to avoid blocking UI
Task.Run(async () => await DisplaySystemInfoAsync());
AutoLogin();
// 🔍 Perform initial connectivity check
@@ -270,6 +276,22 @@ namespace LD_SysInfo
}
}
private async Task DisplaySystemInfoAsync()
{
// Run system info collection on background thread
var sysInfo = await Task.Run(() => SystemInfo.GetSystemInfo());
// Update UI on UI thread
await Dispatcher.InvokeAsync(() =>
{
_cachedSystemInfo = sysInfo;
UpdateSysInfoUI(_cachedSystemInfo);
// Notify that system info has loaded
SystemInfoLoaded?.Invoke(this, EventArgs.Empty);
});
}
private void DisplaySystemInfo()
{
_cachedSystemInfo = SystemInfo.GetSystemInfo();