Initial commit: SpdUp Windows Gaming Booster v1.0.0
- .NET 8 WPF app with full MVVM architecture - One-click boost: CPU, RAM, GPU, network, services, timer resolution - Real-time system monitor (LibreHardwareMonitor) - Auto game detection (30+ games) - RAM optimizer with kernel-level cleanup - Network optimizer (TCP registry tweaks) - Service manager, process manager, shader cache cleaner - Desktop widget overlay - Debug log viewer - Custom dark gaming theme with trans pride colors - 84 unit tests (xUnit) - Inno Setup installer script - Landing page website
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using SpdUp.ViewModels;
|
||||
|
||||
namespace SpdUp.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Floating desktop widget – borderless, transparent, always-on-top.
|
||||
/// </summary>
|
||||
public partial class WidgetWindow : Window
|
||||
{
|
||||
private bool _expanded;
|
||||
|
||||
// ── Win32 click-through support ───────────────────────────────────
|
||||
private const int GWL_EXSTYLE = -20;
|
||||
private const int WS_EX_TRANSPARENT = 0x00000020;
|
||||
private const int WS_EX_TOOLWINDOW = 0x00000080;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int GetWindowLong(IntPtr hwnd, int index);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle);
|
||||
|
||||
public WidgetWindow(MainViewModel vm)
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = vm;
|
||||
|
||||
// Restore position from settings
|
||||
Left = vm.Settings.WidgetOpacity > 0 ? 100 : 100; // default
|
||||
Top = 100;
|
||||
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
// Make it a tool window (no taskbar entry)
|
||||
var hwnd = new WindowInteropHelper(this).Handle;
|
||||
var exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_TOOLWINDOW);
|
||||
|
||||
Opacity = vm.Settings.WidgetOpacity;
|
||||
|
||||
if (!vm.Settings.WidgetCompactMode)
|
||||
ToggleExpand();
|
||||
};
|
||||
}
|
||||
|
||||
private void Widget_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void Widget_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
ToggleExpand();
|
||||
}
|
||||
|
||||
private void Toggle_Click(object sender, RoutedEventArgs e) => ToggleExpand();
|
||||
private void Close_Click(object sender, RoutedEventArgs e) => Close();
|
||||
|
||||
private void ToggleExpand()
|
||||
{
|
||||
_expanded = !_expanded;
|
||||
ExpandedPanel.Visibility = _expanded ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enable click-through: all mouse events pass through to windows below.
|
||||
/// </summary>
|
||||
public void SetClickThrough(bool enable)
|
||||
{
|
||||
var hwnd = new WindowInteropHelper(this).Handle;
|
||||
var exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
|
||||
if (enable)
|
||||
SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_TRANSPARENT);
|
||||
else
|
||||
SetWindowLong(hwnd, GWL_EXSTYLE, exStyle & ~WS_EX_TRANSPARENT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user