First real stable push since migrating

This commit is contained in:
2025-05-05 12:00:24 +08:00
parent e401b01d05
commit f16525e6eb
49 changed files with 3262 additions and 5 deletions

115
LD-SysInfo/App.xaml Normal file
View File

@@ -0,0 +1,115 @@
<Application x:Class="LD_SysInfo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Set to Dark Theme with valid colors -->
<materialDesign:BundledTheme BaseTheme="Dark"
PrimaryColor="BlueGrey"
SecondaryColor="Indigo" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Custom color overrides -->
<SolidColorBrush x:Key="PrimaryBrush" Color="#4776cd" />
<SolidColorBrush x:Key="BackgroundDarkBrush" Color="#333333" />
<SolidColorBrush x:Key="TextBrush" Color="#E5E4E2" />
<SolidColorBrush x:Key="TextDarkBrush" Color="#E5E4E2" />
<SolidColorBrush x:Key="ErrorBrush" Color="#A6262A" />
<SolidColorBrush x:Key="SelectedLightBrush" Color="#E5E4E2" />
<SolidColorBrush x:Key="TitleBrush" Color="#D5484D" />
<SolidColorBrush x:Key="HoverBrush" Color="#3F70CA" />
<!-- Tab colors -->
<SolidColorBrush x:Key="TabUnselectedBrush" Color="#A9A9A9" />
<SolidColorBrush x:Key="TabUnselectedBackGround" Color="#A9A9A9" />
<SolidColorBrush x:Key="TabSelectedBrush" Color="#F3FCF0" />
<SolidColorBrush x:Key="StatusConnectedBrush" Color="green" />
<SolidColorBrush x:Key="HoverBackgroundBrush" Color="#16408D"/>
<!-- Darker blue -->
<SolidColorBrush x:Key="HoverForegroundBrush" Color="#FF173788"/>
<!-- Yellow -->
<Style x:Key="CustomRaisedButton" TargetType="Button" BasedOn="{x:Null}">
<Setter Property="Foreground" Value="{DynamicResource SelectedLightBrush}" />
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Padding" Value="10,5" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="{DynamicResource HoverBrush}" />
<Setter Property="Foreground" Value="{DynamicResource HoverForegroundBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="{DynamicResource HoverBackgroundBrush}" />
<Setter Property="Foreground" Value="{DynamicResource HoverForegroundBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="#555" />
<Setter Property="Foreground" Value="#AAA" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="10,5"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource HoverBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource HoverForegroundBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- TabItem Style -->
<Style TargetType="TabItem">
<Setter Property="Background" Value="{DynamicResource TabUnselectedBackGround}" />
<Setter Property="Foreground" Value="{DynamicResource TabUnselectedBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
<!-- Style for selected tab -->
<Style.Triggers>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter Property="Foreground" Value="{DynamicResource TabSelectedBrush}" />
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<!-- Optionally adjust the border for selected tab -->
<Setter Property="BorderBrush" Value="{DynamicResource TabSelectedBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

56
LD-SysInfo/App.xaml.cs Normal file
View File

@@ -0,0 +1,56 @@
using CommunityToolkit.Mvvm.Messaging;
using MaterialDesignThemes.Wpf;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Windows;
using System.Windows.Threading;
namespace LD_SysInfo;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
[STAThread]
private static void Main(string[] args)
{
MainAsync(args).GetAwaiter().GetResult();
}
private static async Task MainAsync(string[] args)
{
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;
app.Run();
await host.StopAsync().ConfigureAwait(true);
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostBuilderContext, configurationBuilder)
=> configurationBuilder.AddUserSecrets(typeof(App).Assembly))
.ConfigureServices((hostContext, services) =>
{
services.AddSingleton<MainWindow>();
services.AddSingleton<MainWindowViewModel>();
services.AddSingleton<WeakReferenceMessenger>();
services.AddSingleton<IMessenger, WeakReferenceMessenger>(provider => provider.GetRequiredService<WeakReferenceMessenger>());
services.AddSingleton(_ => Current.Dispatcher);
services.AddTransient<ISnackbarMessageQueue>(provider =>
{
Dispatcher dispatcher = provider.GetRequiredService<Dispatcher>();
return new SnackbarMessageQueue(TimeSpan.FromSeconds(3.0), dispatcher);
});
});
}

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
LD-SysInfo/DLShortcut.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,35 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
public class EncryptionHelper
{
private static readonly byte[] Key = Encoding.UTF8.GetBytes("HWJGbwmF2pWdXySDExMNEbJSrXn0YCBF"); // 32 bytes for AES-256
private static readonly byte[] IV = Encoding.UTF8.GetBytes("VWYRtYCfch0sKs6k"); // 16 bytes
public static string EncryptData(string plainText)
{
using (Aes aes = Aes.Create())
{
aes.Key = Key;
aes.IV = IV;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.PKCS7;
using (MemoryStream ms = new MemoryStream())
using (CryptoStream cs = new CryptoStream(ms, aes.CreateEncryptor(), CryptoStreamMode.Write))
{
using (StreamWriter sw = new StreamWriter(cs, new UTF8Encoding(false))) // 🔹 Disable BOM
{
sw.Write(plainText);
}
byte[] encryptedBytes = ms.ToArray();
string encryptedBase64 = Convert.ToBase64String(encryptedBytes);
Console.WriteLine("🔹 [DEBUG] Encrypted Data (Base64): " + encryptedBase64); // ✅ Debugging
return encryptedBase64;
}
}
}
}

View File

@@ -0,0 +1,63 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>PSG-Oversight</AssemblyName>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<StartupObject>LD_SysInfo.App</StartupObject>
<ApplicationIcon>Assets\LDShortcut.ico</ApplicationIcon>
<OutputPath>C:\Users\Sonder\source\repos\psg-oversight-app\BuildDir\bin\Debug\net8.0-windows\</OutputPath>
<IncludeSatelliteAssembliesForPublish>false</IncludeSatelliteAssembliesForPublish>
</PropertyGroup>
<!--
Uncomment to enable single file exe publishing
https://learn.microsoft.com/dotnet/core/deploying/single-file/overview
The Condition on PublishSingleFile is to prevent debugging issues while running as a single file.
Many debugging tools (Snoop, Visual Studio's UI debugging tools for XAML) will not function with PublishSingleFile set to true.
https://github.com/dotnet/runtime/issues/3773
You will also need to remove the no-build option from the `dotnet publish` command on the "dotnet publish" step in .github/workflows/build_app.yml
-->
<!--
<PropertyGroup>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile Condition="'$(Configuration)' != 'Debug'">true</PublishSingleFile>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<SelfContained>true</SelfContained>
</PropertyGroup>
-->
<ItemGroup>
<ApplicationDefinition Remove="App.xaml" />
<None Remove="Assets\trayicon.ico" />
<None Remove="config.json" />
<Content Include="Assets\LDShortcut.ico" />
<Page Include="App.xaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" />
<PackageReference Include="MaterialDesignColors" />
<PackageReference Include="MaterialDesignThemes" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="System.Management" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\trayicon.ico" />
<Content Include="config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

409
LD-SysInfo/MainWindow.xaml Normal file
View File

@@ -0,0 +1,409 @@
<Window x:Class="LD_SysInfo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LD_SysInfo"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:materialDesignAssist="clr-namespace:MaterialDesignThemes.Wpf;assembly=MaterialDesignThemes.Wpf"
mc:Ignorable="d"
Title="PSG - Oversight"
Height="500"
Width="400"
Icon="Assets/trayicon.ico"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
Foreground="{DynamicResource TextDarkBrush}">
<Window.Resources>
<ContextMenu x:Key="TrayMenu">
<MenuItem Header="Show Window" Click="ShowWindow_Click"/>
<MenuItem Header="Exit" Click="Exit_Click"/>
</ContextMenu>
<Style TargetType="TabControl">
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="0" />
</Style>
<Style TargetType="TabItem">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="MinWidth" Value="118" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Grid>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
CornerRadius="6"
Margin="2">
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Header"
Margin="12,4"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<!-- Trigger for selected tab -->
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4776cd" />
<!-- Selected Background -->
<Setter Property="BorderBrush" Value="#E5E4E2" />
<!-- Selected Border -->
<Setter Property="Foreground" Value="#E5E4E2" />
<!-- Selected Text Color -->
</Trigger>
<!-- Explicitly setting background and text for unselected tab -->
<Trigger Property="IsSelected" Value="False">
<Setter Property="Background" Value="#16408D" />
<!-- Unselected Background -->
<Setter Property="BorderBrush" Value="#E5E4E2" />
<!-- Unselected Border -->
<Setter Property="Foreground" Value="#E5E4E2" />
<!-- Unselected Text Color -->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 🔵 Base Style for Minimize and Maximize buttons -->
<Style x:Key="WindowButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextLightBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource HoverBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 🔴 Special Style for the Close button -->
<Style x:Key="CloseButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextLightBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<!-- Hover Effect - Light Red -->
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#D32F2F"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
<!-- Pressed Effect - Darker Red -->
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource DangerBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource DangerTextBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TextBox">
<Setter Property="Foreground" Value="{DynamicResource TextDarkBrush}" />
<Setter Property="Background" Value="{DynamicResource PaperDarkBrush}" />
</Style>
<Style TargetType="PasswordBox">
<Setter Property="Foreground" Value="{DynamicResource TextDarkBrush}" />
<Setter Property="Background" Value="{DynamicResource PaperDarkBrush}" />
</Style>
</Window.Resources>
<!-- Wrap everything in a Grid to ensure Window has only one child -->
<Border CornerRadius="12"
Background="{DynamicResource BackgroundDarkBrush}"
SnapsToDevicePixels="True"
ClipToBounds="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<!-- Titlebar -->
<RowDefinition Height="Auto" />
<!-- Tabs + Theme -->
<RowDefinition Height="*" />
<!-- Tab Content -->
</Grid.RowDefinitions>
<!-- 🔹 Titlebar -->
<Border Grid.Row="0"
CornerRadius="12,12,0,0"
Background="{DynamicResource BackgroundDarkBrush}" Margin="0,0,2,2">
<Grid MouseDown="TitleBar_MouseDown">
<TextBlock Text="PSG - Oversight"
VerticalAlignment="Center"
Margin="10,0,0,0"
FontSize="22"
FontWeight="Bold"
Foreground="{DynamicResource TitleBrush}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="30" Height="30" Click="MinimizeWindow_Click" Style="{StaticResource WindowButtonStyle}">
<materialDesign:PackIcon Kind="WindowMinimize" Width="20" Height="20" />
</Button>
<Button Width="30" Height="30" Click="MaximizeRestoreWindow_Click" Style="{StaticResource WindowButtonStyle}">
<materialDesign:PackIcon Kind="WindowMaximize" Width="20" Height="20" />
</Button>
<Button Width="30" Height="30" Click="CloseWindow_Click" Style="{StaticResource CloseButtonStyle}">
<materialDesign:PackIcon Kind="WindowClose" Width="20" Height="20" />
</Button>
</StackPanel>
</Grid>
</Border>
<!-- 🔹 Tabs + Theme Toggle -->
<Grid Grid.Row="1" Background="{DynamicResource BackgroundDarkBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<!-- MainTabControl with headers visible -->
<TabControl x:Name="MainTabControl"
Grid.Column="0"
Background="{DynamicResource BackgroundDarkBrush}"
BorderThickness="0"
TabStripPlacement="Top"
SelectedIndex="0"
IsTabStop="False"
Padding="0">
<TabItem Header="SysInfo" FontSize="16"/>
<TabItem Header="InstalledApps" FontSize="16"/>
<TabItem Header="Status" FontSize="16"/>
</TabControl>
<!--
<Button Grid.Column="1"
x:Name="ThemeToggleButton"
Style="{StaticResource SmallSquareButtonStyle}"
ToolTip="Toggle Theme"
Click="ThemeToggleButton_Click">
<materialDesign:PackIcon x:Name="ThemeIcon"
Kind="WeatherSunny"
Width="20" Height="20"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Button>
-->
</Grid>
<Border Grid.Row="2"
CornerRadius="0,0,12,12"
Background="Transparent"
ClipToBounds="True">
<!-- 🔹 Tab Content -->
<TabControl x:Name="MainTabContentControl"
Background="Transparent"
BorderThickness="0"
SelectedIndex="{Binding SelectedIndex, ElementName=MainTabControl, Mode=TwoWay}"
Margin="0" Padding="0,0,0,0"
>
<!-- 👇 Hides the TabItem headers -->
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</TabControl.Resources>
<!-- 🔹 SysInfo Tab -->
<TabItem Header="SysInfo">
<StackPanel Margin="5,0,5,0" VerticalAlignment="Top">
<TextBlock x:Name="HostnameTextBlock" Text="Hostname" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<TextBlock x:Name="OSNameTextBlock" Text="OS Name" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<TextBlock x:Name="OSVersionTextBlock" Text="OS Version" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<TextBlock x:Name="WindowsVersionTextBlock" Text="Windows Version" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<TextBlock x:Name="WindowsBuildTextBlock" Text="Windows Build" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<TextBlock x:Name="OSArchitectureTextBlock" Text="OS Architecture" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<TextBlock x:Name="ProcessorNameTextBlock" Text="Processor Name" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<TextBlock x:Name="ProcessorArchitectureTextBlock" Text="Processor Architecture" FontSize="12" Margin="5" Foreground="{DynamicResource TextBrush}" />
<Button Content="Export to CSV"
Style="{StaticResource CustomRaisedButton}"
Background="{DynamicResource PrimaryBrush}"
Foreground="{DynamicResource SelectedLightBrush}"
Click="ExportToCsvButton_Click"
Width="200"
Margin="5"
HorizontalAlignment="Left" />
<Button Content="Save System Info"
Style="{StaticResource CustomRaisedButton}"
Background="{DynamicResource PrimaryBrush}"
Foreground="{DynamicResource SelectedLightBrush}"
Click="StoreSystemInfoButton_Click"
Width="200"
Margin="5"
HorizontalAlignment="Left" />
<CheckBox
x:Name="IncludeInstalledAppsCheckBox"
Content="Include installed Apps?"
FontSize="14"
Margin="5"
Foreground="{DynamicResource TextDarkBrush}"
Style="{StaticResource MaterialDesignCheckBox}" />
<TextBlock x:Name="StatusTextBlock"
FontSize="14"
FontWeight="SemiBold"
Margin="10,5"
Foreground="{DynamicResource ErrorBrush}" />
</StackPanel>
</TabItem>
<!-- 🔹 InstalledApps Tab -->
<TabItem Header="InstalledApps">
<StackPanel Margin="10">
<ListBox x:Name="InstalledAppsListBox" Height="300" Width="350" Margin="5">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text="{Binding Version}" FontStyle="Italic" />
<TextBlock Text="{Binding Publisher}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="Load Installed Applications"
Style="{StaticResource CustomRaisedButton}"
Background="{DynamicResource PrimaryBrush}"
Foreground="{DynamicResource SelectedLightBrush}"
Click="LoadInstalledAppsButton_Click"
Width="200"
Margin="5"
HorizontalAlignment="Left" />
</StackPanel>
</TabItem>
<!-- 🔹 Status Tab -->
<TabItem Header="Status">
<StackPanel Margin="10">
<TextBlock Text="Server Connectivity Status:"
FontSize="14"
FontWeight="SemiBold"
Margin="5"
Foreground="{DynamicResource TextDarkBrush}" />
<TextBlock x:Name="ConnectionStatusTextBlock"
Text="Connected to Server (Ping)"
Foreground="{DynamicResource StatusConnectedBrush}"
FontSize="14"
FontWeight="Bold" />
<StackPanel Orientation="Vertical" Margin="0,10,0,0">
<TextBox x:Name="txtUsername"
Width="200"
Margin="5"
HorizontalAlignment="Left"
/>
<PasswordBox x:Name="pwdPassword"
Width="200"
Margin="5"
HorizontalAlignment="Left" />
</StackPanel>
<Button x:Name="AuthenticateButton"
Content="Login"
Style="{StaticResource CustomRaisedButton}"
Background="{DynamicResource PrimaryBrush}"
Foreground="{DynamicResource SelectedLightBrush}"
Click="AuthenticateButton_Click"
Width="200"
Margin="5"
HorizontalAlignment="Left"
/>
<Separator Margin="10" />
<TextBlock Text="Diagnostic Logs:"
FontSize="14"
FontWeight="SemiBold"
Margin="5"
Foreground="{DynamicResource TextDarkBrush}" />
<Button Content="Generate Logs"
Style="{StaticResource CustomRaisedButton}"
Background="{DynamicResource PrimaryBrush}"
Foreground="{DynamicResource SelectedLightBrush}"
Click="GenerateLogsButton_Click"
Width="200"
Margin="5"
HorizontalAlignment="Left" />
</StackPanel>
</TabItem>
</TabControl>
</Border>
<!-- ✅ Tray Icon (not inside Grid) -->
<tb:TaskbarIcon x:Name="TrayIcon"
ToolTipText="LD SysInfo Running"
ContextMenu="{StaticResource TrayMenu}"
IconSource="/Assets/trayicon.ico" />
</Grid>
</Border>
</Window>

View File

@@ -0,0 +1,626 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.Win32;
using System.IO;
using System.Windows.Threading;
using System.Windows.Forms;
using Hardcodet.Wpf.TaskbarNotification;
using LD_SysInfo.Services;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Windows.Media.Animation;
using LD_SysInfo.Models;
using MaterialDesignColors;
using MaterialDesignThemes.Wpf;
using System.Windows.Input;
using Application = System.Windows.Application;
using System.Windows.Media;
namespace LD_SysInfo
{
public partial class MainWindow : Window
{
private static readonly HttpClient httpClient = new HttpClient();
private static AppConfig _config;
private static string jwtToken = null; // 🔹 Store the JWT token globally in the app
private readonly DispatcherTimer messageClearTimer;
private readonly DispatcherTimer postTimer;
private readonly DispatcherTimer keepAliveTimer;
private readonly Uri LightThemeUri = new Uri("pack://application:,,,/Themes/LightTheme.xaml", UriKind.Absolute);
private readonly Uri DarkThemeUri = new Uri("pack://application:,,,/Themes/DarkTheme.xaml", UriKind.Absolute);
private bool isDarkTheme = false;
private static readonly string ConfigPath = Path.Combine(AppContext.BaseDirectory, "config.json");
public MainWindow()
{
// ⚠️ Temporary SSL Certificate Bypass - For Testing Only
System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
InitializeComponent();
LoadConfig();
DisplaySystemInfo();
AutoLogin();
// 🔍 Perform initial connectivity check
Task.Run(async () => await InitialCheckConnectivity());
// Initialize the system tray icon event
TrayIcon.TrayMouseDoubleClick += TrayIcon_DoubleClick;
// 🔥 Initialize the DispatcherTimer for fading out messages (statically set to 5 seconds)
messageClearTimer = new DispatcherTimer();
messageClearTimer.Interval = TimeSpan.FromSeconds(5); // Set to 5 seconds (static)
messageClearTimer.Tick += MessageClearTimer_Tick;
// 🔥 Initialize the DispatcherTimer for periodic POSTs using _config.PollingInterval
postTimer = new DispatcherTimer();
postTimer.Interval = TimeSpan.FromSeconds(_config.SystemInfoInterval);
postTimer.Tick += PostTimer_Tick;
postTimer.Start();
// 🔁 Initialize the KeepAlive timer using KeepAlivePeriod from config
keepAliveTimer = new DispatcherTimer();
keepAliveTimer.Interval = TimeSpan.FromSeconds(_config.KeepAlivePeriod); // Set from config
keepAliveTimer.Tick += KeepAliveTimer_Tick;
keepAliveTimer.Start();
}
private void LoadConfig()
{
try
{
//System.Windows.MessageBox.Show($"DEBUG: AppContext.BaseDirectory = {AppContext.BaseDirectory}");
//System.Windows.MessageBox.Show($"DEBUG: ConfigPath = {ConfigPath}");
if (!File.Exists((string?)ConfigPath))
{
System.Windows.MessageBox.Show("❌ config.json not found at resolved path!");
}
_config = ConfigManager.LoadConfig(ConfigPath);
if (_config == null || string.IsNullOrWhiteSpace(_config.ClientIdentifier))
{
throw new Exception("❌ Invalid or missing ClientIdentifier in config.json.");
}
}
catch (Exception ex)
{
System.Windows.MessageBox.Show($"❌ Error loading config: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
_config = new AppConfig(); // Prevent application from crashing
}
}
private async Task InitialCheckConnectivity()
{
var apiClient = new ApiClient(_config);
bool isConnected = await apiClient.CheckConnectivity();
// You must update the UI from the UI thread
Dispatcher.Invoke(() =>
{
if (isConnected)
{
ConnectionStatusTextBlock.Text = "Connected to Server";
ConnectionStatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Green);
}
else
{
ConnectionStatusTextBlock.Text = "No Connection";
ConnectionStatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
}
});
}
private async void AutoLogin()
{
if (_config == null || _config.Auth == null ||
string.IsNullOrEmpty(_config.Auth.Username) || string.IsNullOrEmpty(_config.Auth.Password))
{
UpdateStatusUI(false);
return;
}
var apiClient = new ApiClient(_config);
LoginResponse loginResponse = await apiClient.AuthenticateAsync(_config.Auth.Username, _config.Auth.Password);
if (loginResponse != null && !string.IsNullOrEmpty(loginResponse.Token))
{
ApiClient.SetJwtToken(loginResponse.Token);
UpdateStatusUI(true);
}
else
{
UpdateStatusUI(false);
}
}
private async void AuthenticateButton_Click(object sender, RoutedEventArgs e)
{
var apiClient = new ApiClient(_config);
LoginResponse loginResponse = await apiClient.AuthenticateAsync(txtUsername.Text, pwdPassword.Password);
if (loginResponse != null && !string.IsNullOrEmpty(loginResponse.Token))
{
ApiClient.SetJwtToken(loginResponse.Token);
UpdateStatusUI(true); // 🔥 Successfully authenticated
}
else
{
UpdateStatusUI(false);
}
}
private async void CheckConnectivityButton_Click(object sender, RoutedEventArgs e)
{
var apiClient = new ApiClient(_config);
bool isConnected = await apiClient.CheckConnectivity();
if (isConnected)
{
ConnectionStatusTextBlock.Text = "Connected to Server";
ConnectionStatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Green);
}
else
{
ConnectionStatusTextBlock.Text = "No Connection";
ConnectionStatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
}
}
private void GenerateLogsButton_Click(object sender, RoutedEventArgs e)
{
try
{
string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "LD_SysInfo", "Logs");
Directory.CreateDirectory(logDir); // Ensure directory exists
string logFile = Path.Combine(logDir, $"log_{DateTime.Now:yyyyMMdd_HHmmss}.txt");
File.WriteAllText(logFile, "=== LD SysInfo Diagnostic Log ===\n");
File.AppendAllText(logFile, $"Timestamp: {DateTime.Now}\n");
File.AppendAllText(logFile, $"Hostname: {Environment.MachineName}\n");
File.AppendAllText(logFile, $"OS: {Environment.OSVersion}\n");
File.AppendAllText(logFile, $"Server Status: {ConnectionStatusTextBlock.Text}\n");
System.Windows.MessageBox.Show($"Logs generated successfully!\nPath: {logFile}", "Log Generated", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (Exception ex)
{
System.Windows.MessageBox.Show($"Failed to generate logs.\nError: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private void DisplaySystemInfo()
{
var sysInfo = SystemInfo.GetSystemInfo();
OSNameTextBlock.Text = $"OS Name: {sysInfo.OSName}";
OSVersionTextBlock.Text = $"OS Version: {sysInfo.OSVersion}";
WindowsVersionTextBlock.Text = $"Windows Version: {sysInfo.WindowsVersion}";
WindowsBuildTextBlock.Text = $"Windows Build: {sysInfo.WindowsBuild}";
OSArchitectureTextBlock.Text = $"OS Architecture: {sysInfo.OSArchitecture}";
ProcessorNameTextBlock.Text = $"Processor Name: {sysInfo.ProcessorName}";
ProcessorArchitectureTextBlock.Text = $"Processor Architecture: {sysInfo.ProcessorArchitecture}";
HostnameTextBlock.Text = $"Hostname: {sysInfo.Hostname}";
}
private void LoadInstalledAppsButton_Click(object sender, RoutedEventArgs e)
{
var applications = SystemInfo.GetInstalledApplicationsFromRegistry();
InstalledAppsListBox.ItemsSource = applications;
}
private async void StoreSystemInfoButton_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(ApiClient.GetJwtToken())) // Check token via ApiClient
{
System.Windows.MessageBox.Show("❌ Please log in first.", "Not Authenticated", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
try
{
var sysInfo = SystemInfo.GetSystemInfo();
var applications = SystemInfo.GetInstalledApplicationsFromRegistry();
var formattedApplications = new List<object>();
foreach (var app in applications)
{
formattedApplications.Add(new
{
app_name = app.Name,
app_version = app.Version,
publisher = app.Publisher
});
}
var payload = new
{
clientIdentifier = _config.ClientIdentifier,
hostname = sysInfo.Hostname,
osName = sysInfo.OSName,
osVersion = sysInfo.OSVersion,
windowsVersion = sysInfo.WindowsVersion,
windowsBuild = sysInfo.WindowsBuild,
osArchitecture = sysInfo.OSArchitecture,
processorName = sysInfo.ProcessorName,
processorArchitecture = sysInfo.ProcessorArchitecture,
gpuName = sysInfo.GpuNames,
totalMemory = sysInfo.TotalMemory,
ipAddresses = sysInfo.IpAddresses,
lastBootTime = sysInfo.LastBootTime,
drives = sysInfo.Drives,
installedApplications = formattedApplications
};
var apiClient = new ApiClient(_config);
string jsonPayload = JsonConvert.SerializeObject(payload);
Console.WriteLine("🔍 [DEBUG] Raw JSON Payload:\n" + jsonPayload);
string encryptedPayload = EncryptionHelper.EncryptData(jsonPayload);
string response = await apiClient.StoreSystemInfoAsync(encryptedPayload);
if (response.StartsWith("Error"))
{
StatusTextBlock.Text = $"❌ {response}";
StatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
}
else
{
StatusTextBlock.Text = "✅ System info stored successfully!";
StatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Green);
// 🔥 Trigger Fade Out Animation
messageClearTimer.Stop(); // Stop existing timer
FadeOutStatusMessage(); // Start the fade-out animation
}
}
catch (Exception ex)
{
StatusTextBlock.Text = $"❌ Error: {ex.Message}";
StatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
}
}
private void LoadThemeResources(string resourcePath)
{
var dictionaries = Application.Current.Resources.MergedDictionaries;
dictionaries.Clear();
// Add required MaterialDesign v5 resource dictionaries
dictionaries.Add(new ResourceDictionary
{
Source = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml", UriKind.Absolute)
});
dictionaries.Add(new ResourceDictionary
{
Source = new Uri(isDarkTheme
? "pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Dark.xaml"
: "pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Light.xaml", UriKind.Absolute)
});
// Optional: Your custom theme overrides (LightTheme.xaml or DarkTheme.xaml)
dictionaries.Add(new ResourceDictionary
{
Source = new Uri(resourcePath, UriKind.RelativeOrAbsolute)
});
}
private void ThemeToggleButton_Click(object sender, RoutedEventArgs e)
{
isDarkTheme = !isDarkTheme;
LoadThemeResources(isDarkTheme ? "Themes/DarkTheme.xaml" : "Themes/LightTheme.xaml");
}
private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
this.DragMove();
}
}
private void MinimizeWindow_Click(object sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}
private void MaximizeRestoreWindow_Click(object sender, RoutedEventArgs e)
{
if (WindowState == WindowState.Maximized)
WindowState = WindowState.Normal;
else
WindowState = WindowState.Maximized;
}
private void CloseWindow_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void ExportToCsvButton_Click(object sender, RoutedEventArgs e)
{
var saveFileDialog = new Microsoft.Win32.SaveFileDialog
{
Filter = "CSV files (*.csv)|*.csv",
Title = "Save System Info as CSV",
FileName = "SystemInfo.csv"
};
if (saveFileDialog.ShowDialog() == true)
{
var sysInfo = SystemInfo.GetSystemInfo();
try
{
using (var writer = new StreamWriter(saveFileDialog.FileName))
{
writer.WriteLine("Property,Value");
writer.WriteLine($"Hostname,{sysInfo.Hostname}");
writer.WriteLine($"OS Name,{sysInfo.OSName}");
writer.WriteLine($"OS Version,{sysInfo.OSVersion}");
writer.WriteLine($"Windows Version,{sysInfo.WindowsVersion}");
writer.WriteLine($"Windows Build,{sysInfo.WindowsBuild}");
writer.WriteLine($"OS Architecture,{sysInfo.OSArchitecture}");
writer.WriteLine($"Processor Name,{sysInfo.ProcessorName}");
writer.WriteLine($"Processor Architecture,{sysInfo.ProcessorArchitecture}");
if (IncludeInstalledAppsCheckBox.IsChecked == true)
{
writer.WriteLine();
writer.WriteLine("Installed Applications:");
writer.WriteLine("Name,Version,Publisher");
var applications = SystemInfo.GetInstalledApplicationsFromRegistry();
foreach (var app in applications)
{
writer.WriteLine($"{app.Name},{app.Version},{app.Publisher}");
}
}
}
StatusTextBlock.Text = "System info exported successfully!";
messageClearTimer.Start(); // Start the timer to clear the message after 5 seconds
}
catch (Exception ex)
{
StatusTextBlock.Text = $"Error saving file: {ex.Message}";
}
}
}
private async void UpdateStatusUI(bool isAuthenticated)
{
// Ensure we're on the UI thread before updating UI elements
Dispatcher.Invoke(() =>
{
if (isAuthenticated)
{
txtUsername.Visibility = Visibility.Collapsed;
pwdPassword.Visibility = Visibility.Collapsed;
AuthenticateButton.Visibility = Visibility.Collapsed;
StatusTextBlock.Text = "✅ Authenticated - Connected to Server";
StatusTextBlock.Foreground = (SolidColorBrush)FindResource("StatusConnectedBrush"); // Use your custom brush
// 🔍 Check connectivity to the server
var apiClient = new ApiClient(_config);
Task.Run(async () =>
{
bool isConnected = await apiClient.CheckConnectivity();
// Update connection status on the UI thread
Dispatcher.Invoke(() =>
{
if (isConnected)
{
ConnectionStatusTextBlock.Text = "Connected to Server";
ConnectionStatusTextBlock.Foreground = (SolidColorBrush)FindResource("StatusConnectedBrush"); // Use your custom brush
}
else
{
ConnectionStatusTextBlock.Text = "No Connection";
ConnectionStatusTextBlock.Foreground = (SolidColorBrush)FindResource("ErrorBrush"); // Use your custom error color
}
});
});
// 🔥 Start the timer to clear the message after a delay
messageClearTimer.Stop(); // Stop any running timer first
messageClearTimer.Start();
}
else
{
txtUsername.Visibility = Visibility.Visible;
pwdPassword.Visibility = Visibility.Visible;
AuthenticateButton.Visibility = Visibility.Visible;
StatusTextBlock.Text = "❌ Not Authenticated - Please Log In";
StatusTextBlock.Foreground = (SolidColorBrush)FindResource("ErrorBrush"); // Use your custom error color
ConnectionStatusTextBlock.Text = "No Connection";
ConnectionStatusTextBlock.Foreground = (SolidColorBrush)FindResource("ErrorBrush"); // Use your custom error color
// Stop the timer if the user is not authenticated
messageClearTimer.Stop();
}
});
}
private void FadeOutStatusMessage()
{
var fadeOutAnimation = new DoubleAnimation
{
From = 1.0,
To = 0.0,
Duration = TimeSpan.FromSeconds(3),
AutoReverse = false
};
fadeOutAnimation.Completed += (s, e) =>
{
StatusTextBlock.Text = string.Empty; // Clear the text after fading
StatusTextBlock.Opacity = 1.0; // Reset the opacity for future use
};
StatusTextBlock.BeginAnimation(OpacityProperty, fadeOutAnimation);
messageClearTimer.Stop();
}
private async void PostTimer_Tick(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(ApiClient.GetJwtToken())) // Ensure authentication is active
{
StatusTextBlock.Text = "❌ Not authenticated. Please log in first.";
return;
}
var apiClient = new ApiClient(_config); // Create an instance of ApiClient
var sysInfo = SystemInfo.GetSystemInfo();
var applications = SystemInfo.GetInstalledApplicationsFromRegistry();
var formattedApplications = new List<object>();
foreach (var app in applications)
{
formattedApplications.Add(new
{
app_name = app.Name,
app_version = app.Version,
publisher = app.Publisher
});
}
var payload = new
{
clientIdentifier = _config.ClientIdentifier,
hostname = sysInfo.Hostname,
osName = sysInfo.OSName,
osVersion = sysInfo.OSVersion,
windowsVersion = sysInfo.WindowsVersion,
windowsBuild = sysInfo.WindowsBuild,
osArchitecture = sysInfo.OSArchitecture,
processorName = sysInfo.ProcessorName,
processorArchitecture = sysInfo.ProcessorArchitecture,
gpuName = sysInfo.GpuNames,
totalMemory = sysInfo.TotalMemory,
ipAddresses = sysInfo.IpAddresses,
lastBootTime = sysInfo.LastBootTime,
drives = sysInfo.Drives,
installedApplications = formattedApplications
};
string jsonPayload = JsonConvert.SerializeObject(payload);
Console.WriteLine("🔍 [DEBUG] Raw JSON Payload:\n" + jsonPayload);
string encryptedPayload = EncryptionHelper.EncryptData(jsonPayload);
string response = await apiClient.StoreSystemInfoAsync(encryptedPayload);
if (response.StartsWith("Error"))
{
StatusTextBlock.Text = $"❌ {response}";
StatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
}
else
{
StatusTextBlock.Text = "✅ System info stored successfully!";
StatusTextBlock.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Green);
messageClearTimer.Stop();
FadeOutStatusMessage();
}
}
private async void KeepAliveTimer_Tick(object sender, EventArgs e)
{
var apiClient = new ApiClient(_config);
bool isConnected = await apiClient.CheckConnectivity();
Dispatcher.Invoke(() =>
{
if (isConnected)
{
ConnectionStatusTextBlock.Text = "Connected to Server (Ping)";
// Use the custom gold color for connection status
ConnectionStatusTextBlock.Foreground = (SolidColorBrush)FindResource("StatusConnectedBrush");
}
else
{
ConnectionStatusTextBlock.Text = "No Connection";
// Use the custom error color for no connection
ConnectionStatusTextBlock.Foreground = (SolidColorBrush)FindResource("ErrorBrush");
}
});
}
private void MessageClearTimer_Tick(object sender, EventArgs e)
{
FadeOutStatusMessage(); // Trigger the fade-out effect
}
private void TrayIcon_DoubleClick(object sender, RoutedEventArgs e)
{
ShowWindow();
}
private void ShowWindow_Click(object sender, RoutedEventArgs e)
{
ShowWindow();
}
private void ShowWindow()
{
this.Show();
this.WindowState = WindowState.Normal;
}
private void Exit_Click(object sender, RoutedEventArgs e)
{
TrayIcon.Dispose();
System.Windows.Application.Current.Shutdown();
}
// Minimize to system tray instead of closing
protected override void OnStateChanged(EventArgs e)
{
if (WindowState == WindowState.Minimized)
{
this.Hide(); // Hide the window when minimized
}
base.OnStateChanged(e);
}
}
}

View File

@@ -0,0 +1,36 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
namespace LD_SysInfo;
public partial class MainWindowViewModel : ObservableObject
{
//This is using the source generators from CommunityToolkit.Mvvm to generate a RelayCommand
//See: https://learn.microsoft.com/dotnet/communitytoolkit/mvvm/generators/observableproperty
//and: https://learn.microsoft.com/windows/communitytoolkit/mvvm/observableobject
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(IncrementCountCommand))]
private int _count;
public MainWindowViewModel()
{
}
//This is using the source generators from CommunityToolkit.Mvvm to generate a RelayCommand
//See: https://learn.microsoft.com/dotnet/communitytoolkit/mvvm/generators/relaycommand
//and: https://learn.microsoft.com/windows/communitytoolkit/mvvm/relaycommand
[RelayCommand(CanExecute = nameof(CanIncrementCount))]
private void IncrementCount()
{
Count++;
}
private bool CanIncrementCount() => Count < 5;
[RelayCommand]
private void ClearCount()
{
Count = 0;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -0,0 +1,206 @@
using System;
using System.IO;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Windows;
using LD_SysInfo.Models;
namespace LD_SysInfo.Services
{
public class ApiClient
{
/// <summary>
/// Constructs the full URL for API requests.
/// </summary>
private static readonly HttpClient httpClient = CreateHttpClient();
private readonly AppConfig _config;
private static string jwtToken = null; // 🔹 Store the JWT token globally
public ApiClient(AppConfig config)
{
_config = config ?? throw new ArgumentNullException(nameof(config));
}
private string BuildUrl(string route)
{
return $"{_config.ServerUrl.TrimEnd('/')}/{route.TrimStart('/')}";
}
/// <summary>
/// Creates an HttpClient that bypasses SSL validation (for testing purposes only).
/// </summary>
public static HttpClient CreateHttpClient()
{
HttpClientHandler handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, certChain, sslPolicyErrors) =>
{
return true; // 🔥 Ignores all SSL certificate warnings (TEMPORARY!)
}
};
return new HttpClient(handler);
}
/// <summary>
/// Sets the JWT token to be used for subsequent requests.
/// </summary>
public static void SetJwtToken(string token)
{
jwtToken = token;
httpClient.DefaultRequestHeaders.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", jwtToken);
}
/// <summary>
/// Gets the JWT token to be used for subsequent requests.
/// </summary>
public static string GetJwtToken()
{
return jwtToken;
}
/// <summary>
/// Authenticates with the API using credentials from config.json.
/// </summary>
public async Task<LoginResponse> AuthenticateAsync(string username, string password)
{
try
{
string encryptedUsername = EncryptionHelper.EncryptData(username);
string encryptedPassword = EncryptionHelper.EncryptData(password);
var payload = new
{
username = encryptedUsername,
password = encryptedPassword
};
string jsonContent = JsonConvert.SerializeObject(payload);
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
HttpResponseMessage response = await httpClient.PostAsync(BuildUrl("/api/auth/login"), content);
string rawResponse = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
Console.WriteLine($"❌ Authentication failed: {response.StatusCode} - {rawResponse}");
return null;
}
var loginResponse = JsonConvert.DeserializeObject<LoginResponse>(rawResponse);
if (!string.IsNullOrEmpty(loginResponse?.Token))
{
SetJwtToken(loginResponse.Token);
}
return loginResponse;
}
catch (Exception ex)
{
Console.WriteLine($"❌ Exception during login: {ex.Message}");
return null;
}
}
/// <summary>
/// Checks connectivity to the server using the stored JWT token.
/// </summary>
public async Task<bool> CheckConnectivity()
{
string testUrl = "https://localhost:8443/api/system/ping-status"; // Your HTTPS URL with port 8443
try
{
if (string.IsNullOrEmpty(jwtToken))
{
throw new Exception("No JWT token stored. Please authenticate first.");
}
var response = await SendWithAutoReauthAsync(() =>
httpClient.GetAsync(testUrl)
);
if (response.IsSuccessStatusCode)
{
return true;
}
else
{
Console.WriteLine($"❌ Server Unreachable: {response.StatusCode}");
return false;
}
}
catch (Exception ex)
{
Console.WriteLine($"❌ Connection Error: {ex.Message}");
return false;
}
}
/// <summary>
/// Sends the collected data to the server.
/// </summary>
public async Task<string> StoreSystemInfoAsync(string encryptedData)
{
try
{
if (string.IsNullOrEmpty(jwtToken))
return "❌ Error: Not authenticated. Please log in first.";
var payload = new { data = encryptedData };
string jsonContent = JsonConvert.SerializeObject(payload);
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
var response = await SendWithAutoReauthAsync(() =>
httpClient.PostAsync(BuildUrl("/api/system-info"), content)
);
if (response.IsSuccessStatusCode)
return await response.Content.ReadAsStringAsync();
else
return $"❌ Error: {response.StatusCode} - {await response.Content.ReadAsStringAsync()}";
}
catch (Exception ex)
{
return $"❌ Exception: {ex.Message}";
}
}
/// <summary>
/// Sends the collected data to the server.
/// </summary>
private async Task<HttpResponseMessage> SendWithAutoReauthAsync(Func<Task<HttpResponseMessage>> requestFunc)
{
var response = await requestFunc();
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
{
Console.WriteLine("⚠️ Token expired or invalid. Attempting re-auth...");
var loginResponse = await AuthenticateAsync(_config.Auth.Username, _config.Auth.Password);
if (loginResponse == null || string.IsNullOrEmpty(loginResponse.Token))
{
Console.WriteLine("❌ Re-authentication failed.");
return response; // Return original 401 response
}
// Retry original request after reauth
response = await requestFunc();
}
return response;
}
}
}

View File

@@ -0,0 +1,9 @@
namespace LD_SysInfo.Models
{
public class LoginResponse
{
public string Token { get; set; }
public string Username { get; set; }
public int UserId { get; set; }
}
}

345
LD-SysInfo/SystemInfo.cs Normal file
View File

@@ -0,0 +1,345 @@
using Microsoft.Win32;
using System.IO;
using System.Management;
using System.Diagnostics;
using System.Net.NetworkInformation;
using Newtonsoft.Json;
using System.Windows;
namespace LD_SysInfo
{
public class AppConfig
{
[JsonProperty("ServerUrl")]
public string ServerUrl { get; set; } = "https://yourserver.com/api/status";
[JsonProperty("EnableLogging")]
public bool EnableLogging { get; set; } = true;
[JsonProperty("KeepAlivePeriod")]
public int KeepAlivePeriod { get; set; } = 30; // Ping/heartbeat every 30 seconds
[JsonProperty("SystemInfoInterval")]
public int SystemInfoInterval { get; set; } = 60; // Full system info POST every 60 seconds
[JsonProperty("ClientIdentifier")]
public string ClientIdentifier { get; set; } = "your-default-client-id";
[JsonProperty("Auth")]
public AuthConfig Auth { get; set; } = new AuthConfig();
}
public class AuthConfig
{
[JsonProperty("Username")]
public string Username { get; set; } = "testuser";
[JsonProperty("Password")]
public string Password { get; set; } = "testpassword";
}
public static class ConfigManager
{
private static readonly string ConfigPath =
Path.Combine(AppContext.BaseDirectory, "config.json");
public static AppConfig LoadConfig(string configPath)
{
//System.Windows.MessageBox.Show($"[DEBUG] Calling LoadConfig from:\n{ConfigPath}");
if (File.Exists(ConfigPath))
{
string json = File.ReadAllText(ConfigPath);
return JsonConvert.DeserializeObject<AppConfig>(json);
}
throw new FileNotFoundException("❌ Config file not found at:\n" + ConfigPath);
}
}
public class InstalledApplication
{
public string Name { get; set; }
public string Version { get; set; }
public string Publisher { get; set; }
}
public class DriveInfoSummary
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("totalSizeGB")]
public double TotalSizeGB { get; set; }
[JsonProperty("freeSpaceGB")]
public double FreeSpaceGB { get; set; }
[JsonProperty("driveType")]
public string DriveType { get; set; }
}
public class NetworkInterfaceInfo
{
[JsonProperty("interfaceName")]
public string InterfaceName { get; set; }
[JsonProperty("ipAddress")]
public string IpAddress { get; set; }
[JsonProperty("macAddress")]
public string MacAddress { get; set; }
}
public class SystemInfo
{
[JsonProperty("osName")]
public string OSName { get; set; }
[JsonProperty("osVersion")]
public string OSVersion { get; set; }
[JsonProperty("windowsVersion")]
public string WindowsVersion { get; set; }
[JsonProperty("windowsBuild")]
public string WindowsBuild { get; set; }
[JsonProperty("osArchitecture")]
public string OSArchitecture { get; set; }
[JsonProperty("processorName")]
public string ProcessorName { get; set; }
[JsonProperty("processorArchitecture")]
public string ProcessorArchitecture { get; set; }
[JsonProperty("hostname")]
public string Hostname { get; set; }
[JsonProperty("gpuNames")]
public List<string> GpuNames { get; set; }
[JsonProperty("totalMemory")]
public string TotalMemory { get; set; }
[JsonProperty("ipAddresses")]
public List<NetworkInterfaceInfo> IpAddresses { get; set; } = new();
[JsonProperty("lastBootTime")]
public string LastBootTime { get; set; }
[JsonProperty("installedApplications")]
public List<InstalledApplication> InstalledApplications { get; set; }
[JsonProperty("drives")]
public List<DriveInfoSummary> Drives { get; set; } = new();
private const string WindowsCurrentVersionKey = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";
public static SystemInfo GetSystemInfo()
{
var sysInfo = new SystemInfo();
try
{
sysInfo.Hostname = Environment.MachineName;
sysInfo.OSName = GetOSFriendlyName();
sysInfo.OSVersion = Environment.OSVersion.Version.ToString();
sysInfo.WindowsVersion = GetRegistryValue(WindowsCurrentVersionKey, "DisplayVersion");
sysInfo.WindowsBuild = GetRegistryValue(WindowsCurrentVersionKey, "CurrentBuild");
sysInfo.OSArchitecture = Environment.Is64BitOperatingSystem ? "x64" : "x86";
sysInfo.ProcessorName = GetProcessorName();
sysInfo.ProcessorArchitecture = Environment.Is64BitProcess ? "x64" : "x86";
sysInfo.GpuNames = GetGpuNames();
sysInfo.TotalMemory = GetTotalMemory();
var allInterfaces = GetNetworkInterfaces();
sysInfo.IpAddresses = allInterfaces
.Where(i => !string.IsNullOrWhiteSpace(i.InterfaceName))
.ToList();
sysInfo.LastBootTime = GetLastBootTime();
PopulateDriveInfo(sysInfo);
}
catch (Exception ex)
{
string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "LD_SysInfo", "SysInfo_ErrorLog.txt");
Directory.CreateDirectory(Path.GetDirectoryName(logPath));
File.AppendAllText(logPath, $"[{DateTime.Now}] ERROR: {ex.Message}\n");
}
return sysInfo;
}
private static void PopulateDriveInfo(SystemInfo info)
{
foreach (var drive in DriveInfo.GetDrives())
{
if (!drive.IsReady) continue;
info.Drives.Add(new DriveInfoSummary
{
Name = drive.Name,
TotalSizeGB = Math.Round(drive.TotalSize / (1024.0 * 1024 * 1024), 2),
FreeSpaceGB = Math.Round(drive.AvailableFreeSpace / (1024.0 * 1024 * 1024), 2),
DriveType = drive.DriveType.ToString()
});
}
}
private static string GetRegistryValue(string key, string valueName)
{
using RegistryKey rk = Registry.LocalMachine.OpenSubKey(key);
return rk?.GetValue(valueName)?.ToString();
}
private static string GetOSFriendlyName()
{
string productName = GetRegistryValue(WindowsCurrentVersionKey, "ProductName");
string build = GetRegistryValue(WindowsCurrentVersionKey, "CurrentBuild");
if (int.TryParse(build, out int buildNumber) && buildNumber >= 22000)
return "Windows 11 Pro";
return productName ?? "Unknown OS";
}
private static string GetProcessorName()
{
const string key = @"HARDWARE\DESCRIPTION\System\CentralProcessor\0";
return GetRegistryValue(key, "ProcessorNameString");
}
private static List<string> GetGpuNames()
{
var gpuNames = new List<string>();
try
{
using var searcher = new ManagementObjectSearcher("SELECT Name FROM Win32_VideoController");
foreach (var obj in searcher.Get())
{
string name = obj["Name"]?.ToString();
if (!string.IsNullOrEmpty(name))
{
gpuNames.Add(name);
}
}
}
catch (Exception ex)
{
gpuNames.Add($"Error: {ex.Message}");
}
return gpuNames;
}
private static string GetTotalMemory()
{
try
{
using var searcher = new ManagementObjectSearcher("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem");
foreach (var obj in searcher.Get())
{
long bytes = Convert.ToInt64(obj["TotalPhysicalMemory"]);
return $"{bytes / (1024 * 1024)} MB";
}
}
catch { }
return null;
}
private static List<NetworkInterfaceInfo> GetNetworkInterfaces()
{
var interfaces = new List<NetworkInterfaceInfo>();
try
{
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
{
if (adapter.OperationalStatus != OperationalStatus.Up) continue;
var ip = adapter.GetIPProperties().UnicastAddresses
.FirstOrDefault(a => a.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
var mac = adapter.GetPhysicalAddress();
var macAddress = mac?.GetAddressBytes().Length > 0
? string.Join(":", mac.GetAddressBytes().Select(b => b.ToString("X2")))
: null;
if (ip != null || macAddress != null)
{
interfaces.Add(new NetworkInterfaceInfo
{
InterfaceName = adapter.Name,
IpAddress = ip?.Address.ToString(),
MacAddress = macAddress
});
}
}
}
catch (Exception ex)
{
Console.WriteLine($"❌ Failed to gather network interfaces: {ex.Message}");
}
return interfaces;
}
private static string GetLastBootTime()
{
try
{
using var searcher = new ManagementObjectSearcher("SELECT LastBootUpTime FROM Win32_OperatingSystem WHERE Primary='true'");
foreach (var obj in searcher.Get())
{
string lastBoot = obj["LastBootUpTime"]?.ToString();
return ManagementDateTimeConverter.ToDateTime(lastBoot).ToString("o");
}
}
catch { }
return null;
}
public static List<InstalledApplication> GetInstalledApplicationsFromRegistry()
{
var applications = new List<InstalledApplication>();
string[] registryKeys = {
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
};
foreach (string key in registryKeys)
{
using var regKey = Registry.LocalMachine.OpenSubKey(key);
if (regKey == null) continue;
foreach (string subKeyName in regKey.GetSubKeyNames())
{
using var subKey = regKey.OpenSubKey(subKeyName);
string name = subKey?.GetValue("DisplayName")?.ToString();
if (!string.IsNullOrWhiteSpace(name))
{
applications.Add(new InstalledApplication
{
Name = name,
Version = subKey?.GetValue("DisplayVersion")?.ToString(),
Publisher = subKey?.GetValue("Publisher")?.ToString()
});
}
}
}
return applications;
}
}
}

View File

@@ -0,0 +1,69 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- Brand Colors -->
<Color x:Key="PrimaryColorValue">#1E3A8A</Color>
<!-- Storm blue -->
<Color x:Key="SecondaryColorValue">#6B21A8</Color>
<!-- Deep violet -->
<Color x:Key="BackgroundLightValue">#1F1F1F</Color>
<!-- Dark grey -->
<Color x:Key="BackgroundDarkValue">#121212</Color>
<Color x:Key="PaperLightValue">#2A2A2A</Color>
<Color x:Key="PaperDarkValue">#1E1E1E</Color>
<Color x:Key="TextLightValue">#E5E7EB</Color>
<!-- Light grey text -->
<Color x:Key="TextDarkValue">#F9FAFB</Color>
<!-- Slightly lighter -->
<Color x:Key="DrawerDarkValue">#1A1A1A</Color>
<Color x:Key="SelectedLightValue">#374151</Color>
<!-- Slate -->
<Color x:Key="SelectedDarkValue">#2A2A2A</Color>
<Color x:Key="LinkLightValue">#60A5FA</Color>
<Color x:Key="LinkDarkValue">#3B82F6</Color>
<Color x:Key="ErrorColorValue">#DC2626</Color>
<Color x:Key="WarningColorValue">#F59E0B</Color>
<Color x:Key="SuccessColorValue">#16A34A</Color>
<Color x:Key="InfoColorValue">#0EA5E9</Color>
<!-- SolidColorBrushes -->
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource SecondaryColorValue}" />
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLightValue}" />
<SolidColorBrush x:Key="BackgroundDarkBrush" Color="{StaticResource BackgroundDarkValue}" />
<SolidColorBrush x:Key="PaperLightBrush" Color="{StaticResource PaperLightValue}" />
<SolidColorBrush x:Key="PaperDarkBrush" Color="{StaticResource PaperDarkValue}" />
<SolidColorBrush x:Key="TextLightBrush" Color="{StaticResource TextLightValue}" />
<SolidColorBrush x:Key="TextDarkBrush" Color="{StaticResource TextDarkValue}" />
<SolidColorBrush x:Key="DrawerDarkBrush" Color="{StaticResource DrawerDarkValue}" />
<SolidColorBrush x:Key="SelectedLightBrush" Color="{StaticResource SelectedLightValue}" />
<SolidColorBrush x:Key="SelectedDarkBrush" Color="{StaticResource SelectedDarkValue}" />
<SolidColorBrush x:Key="LinkLightBrush" Color="{StaticResource LinkLightValue}" />
<SolidColorBrush x:Key="LinkDarkBrush" Color="{StaticResource LinkDarkValue}" />
<SolidColorBrush x:Key="ErrorBrush" Color="{StaticResource ErrorColorValue}" />
<SolidColorBrush x:Key="WarningBrush" Color="{StaticResource WarningColorValue}" />
<SolidColorBrush x:Key="SuccessBrush" Color="{StaticResource SuccessColorValue}" />
<SolidColorBrush x:Key="InfoBrush" Color="{StaticResource InfoColorValue}" />
<!-- Aliases for Dynamic Resources -->
<SolidColorBrush x:Key="TextBrush" Color="{StaticResource TextLightValue}" />
<!-- CheckBox Styling Overrides -->
<SolidColorBrush x:Key="MaterialDesignCheckBoxCheckedBackground" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxCheckedBorder" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxCheckedGlyph" Color="{StaticResource TextDarkValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxForeground" Color="{StaticResource TextLightValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxDisabledForeground" Color="#6B7280" />
<!-- Muted grey -->
</ResourceDictionary>

View File

@@ -0,0 +1,42 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
<!-- Brand Colors -->
<Color x:Key="PrimaryColorValue">#2563EB</Color>
<!-- Tailwind Blue-600 -->
<Color x:Key="SecondaryColorValue">#9333EA</Color>
<!-- Tailwind Purple-600 -->
<Color x:Key="BackgroundColorValue">#1F2937</Color>
<!-- Slate-800 -->
<Color x:Key="TextColorValue">#F3F4F6</Color>
<!-- Gray-100 -->
<Color x:Key="SelectedColorValue">#374151</Color>
<!-- Slate-700 -->
<!-- Main window base background -->
<Color x:Key="WindowBackgroundColor">#1F2937</Color>
<!-- Match background -->
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="{StaticResource WindowBackgroundColor}" />
<!-- Brushes -->
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource SecondaryColorValue}" />
<SolidColorBrush x:Key="BackgroundBrush" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="TextBrush" Color="{StaticResource TextColorValue}" />
<SolidColorBrush x:Key="SelectedBrush" Color="{StaticResource SelectedColorValue}" />
<SolidColorBrush x:Key="TextDarkBrush" Color="#1F2937" />
<!-- MaterialDesign3 overrides -->
<SolidColorBrush x:Key="MaterialDesignControlCheckBoxCheckedBrush" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="MaterialDesignControlCheckBoxUncheckedBrush" Color="#666666" />
<SolidColorBrush x:Key="MaterialDesignControlCheckBoxRippleBrush" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxForeground" Color="{StaticResource TextColorValue}" />
<!-- Optional: override background/paper color if you're using ColorZoneAssist -->
<SolidColorBrush x:Key="MaterialDesignPaper" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="MaterialDesignBody" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCardBackground" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxForegroundDark" Color="{StaticResource TextColorValue}" />
</ResourceDictionary>

View File

@@ -0,0 +1,40 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes">
<!-- Brand Colors -->
<Color x:Key="PrimaryColorValue">#2563EB</Color>
<!-- Tailwind Blue-600 -->
<Color x:Key="SecondaryColorValue">#9333EA</Color>
<!-- Tailwind Purple-600 -->
<Color x:Key="BackgroundColorValue">#F9FAFB</Color>
<Color x:Key="TextColorValue">#1F2937</Color>
<Color x:Key="SelectedColorValue">#D1D5DB</Color>
<!-- Main window base background -->
<Color x:Key="WindowBackgroundColor">#F9FAFB</Color>
<!-- or #FFFFFF -->
<SolidColorBrush x:Key="WindowBackgroundBrush" Color="{StaticResource WindowBackgroundColor}" />
<!-- Brushes -->
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource SecondaryColorValue}" />
<SolidColorBrush x:Key="BackgroundBrush" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="TextBrush" Color="{StaticResource TextColorValue}" />
<SolidColorBrush x:Key="SelectedBrush" Color="{StaticResource SelectedColorValue}" />
<SolidColorBrush x:Key="TextLightBrush" Color="#F9FAFB" />
<!-- MaterialDesign3 overrides -->
<SolidColorBrush x:Key="MaterialDesignControlCheckBoxCheckedBrush" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="MaterialDesignControlCheckBoxUncheckedBrush" Color="#B0B0B0" />
<SolidColorBrush x:Key="MaterialDesignControlCheckBoxRippleBrush" Color="{StaticResource PrimaryColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxForeground" Color="{StaticResource TextColorValue}" />
<!-- Optional: override background/paper color if you're using ColorZoneAssist -->
<SolidColorBrush x:Key="MaterialDesignPaper" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="MaterialDesignBody" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCardBackground" Color="{StaticResource BackgroundColorValue}" />
<SolidColorBrush x:Key="MaterialDesignCheckBoxForegroundLight" Color="{StaticResource TextColorValue}" />
</ResourceDictionary>

11
LD-SysInfo/config.json Normal file
View File

@@ -0,0 +1,11 @@
{
"ServerUrl": "https://sys.psg.net.au:8443",
"EnableLogging": true,
"KeepAlivePeriod": 30,
"SystemInfoInterval": 600,
"Auth": {
"Username": "testuser",
"Password": "testuser"
},
"ClientIdentifier": "f2fb7a38-622a-4ce9-86e8-a0e34d24564f"
}