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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@@ -51,11 +51,15 @@
<ApplicationDefinition Remove="App.xaml" />
<None Remove="Assets\osqueryi.exe" />
<None Remove="Assets\trayicon.ico" />
<None Remove="Assets\splash.png" />
<None Remove="config.json" />
<Content Include="Assets\LDShortcut.ico" />
<Content Include="Assets\osqueryi.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<SplashScreen Include="Assets\splash.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</SplashScreen>
<Page Include="App.xaml" />
</ItemGroup>

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();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

View File

@@ -1,35 +0,0 @@
<Project Sdk="WixToolset.Sdk/5.0.2">
<PropertyGroup>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<SuppressAllWarnings>false</SuppressAllWarnings>
<Pedantic>true</Pedantic>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\LDShortcut.ico" />
<Content Include="Assets\windowsdesktop-runtime-8.0.13-win-x64.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LD-SysInfo\LD-SysInfo.csproj">
<Name>LD-SysInfo</Name>
<Project>{604bf69a-6bff-4637-88b5-78936c7eb68f}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.UI.wixext" Version="5.0.2" />
</ItemGroup>
<Target Name="CollectSuggestedVisualStudioComponentIds" />
</Project>

View File

@@ -1,36 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package
Name="LD SystemInfo"
Language="1033"
Version="1.0.0.1"
Manufacturer="Paragon Systems Group"
UpgradeCode="9D09C022-75B6-47B5-A211-59B7CE8E7B6B"
InstallerVersion="500">
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="MainFeature" Title="LD SysInfo" Level="1">
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="AssetsComponent" />
</Feature>
<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="LD_SysInfo">
<Directory Id="AppFolder" Name="App">
<Component Id="MainExecutable" Guid="B769A39D-4807-4D12-B0CB-808E037DFA21" >
<File Id="MainEXE" Name="LD-SysInfo.exe" Source="LD-SysInfo.exe" KeyPath="yes" />
<RegistryValue Root="HKLM" Key="Software\LD_SysInfo" Name="Installed" Type="integer" Value="1" />
</Component>
</Directory>
<Directory Id="AssetsFolder" Name="Assets">
<Component Id="AssetsComponent" Guid="5E6F1D88-36E6-44F1-BD4C-BFC58B47A10D">
<File Id="TrayIconIco" Name="trayicon.ico" Source="Assets\trayicon.ico" />
<File Id="LDShortcutIconFile" Name="LDShortcut.ico" Source="Assets\LDShortcut.ico" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</StandardDirectory>
</Package>
</Wix>

View File

@@ -1,6 +1,8 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Directory Id="AssetsDir" Name="Assets" />
<Component Id="cmpUPL4zyYGpfRaDjFUWL7r0.VHZKs" Guid="F0E00FBB-B63A-4DED-A177-8E79C2A4C1CB">
<File Id="fil_giGueDAhkHg7IGVpG9lWyNnt9g" KeyPath="yes" Source="C:\Users\Sonder\source\repos\psg-oversight-app\PublishDir\config.json" />
</Component>
@@ -25,6 +27,12 @@
<Component Id="cmppJtSGEjpkqcE6B80qiNcp7uzu_E" Guid="7296EA6A-9666-4934-896D-EB3CFE7DADD9">
<File Id="filBmC5aLvP1Wdue27MeciP9pIZ9E0" KeyPath="yes" Source="C:\Users\Sonder\source\repos\psg-oversight-app\PublishDir\wpfgfx_cor3.dll" />
</Component>
<Component Id="cmpOsqueryiExe" Guid="78D245E5-73F1-4D1B-AC1D-E17FAB258CFD"
Directory="AssetsDir">
<File Id="filOsqueryiExe" KeyPath="yes"
Source="C:\Users\Sonder\source\repos\psg-oversight-app\PublishDir\Assets\osqueryi.exe" />
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
@@ -37,6 +45,7 @@
<ComponentRef Id="cmp9p11pVvfHzWT3MHfTpVVHhJz4Mc" />
<ComponentRef Id="cmpIlHre.6vyW_rNEMiyejz2LzF40A" />
<ComponentRef Id="cmppJtSGEjpkqcE6B80qiNcp7uzu_E" />
<ComponentRef Id="cmpOsqueryiExe" />
</ComponentGroup>
</Fragment>
</Wix>

View File

@@ -50,6 +50,7 @@
<Content Include="Assets\DLShortcut.ico" CopyToOutputDirectory="Always" />
<Content Include="Assets\trayicon.ico" CopyToOutputDirectory="Always" />
<Content Include="bpl.rtf" CopyToOutputDirectory="Always" />
<Content Include="Assets\osqueryi.exe" CopyToOutputDirectory="Always" />
<None Include="Assets\windowsdesktop-runtime-8.0.13-win-x64.exe" />
</ItemGroup>

View File

@@ -89,6 +89,7 @@
<Feature Id="Main" Title="DL SysInfo" Level="1">
<ComponentGroupRef Id="AppFiles" />
<ComponentRef Id="StartMenuShortcutComponent" />
<ComponentRef Id="cmpOsqueryiExe" />
<ComponentRef Id="AppMetadata" />
</Feature>