Files
pulsedock/docs/ARCHITECTURE.md
T

49 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Architecture & Technical Design PulseDock
## Overview
PulseDock is built on modern C# .NET 10 WPF architecture leveraging Dependency Injection, MVVM separation, and non-blocking background telemetry sampling.
```
┌─────────────────────────┐
│ App Bootstrapper │
│ (Microsoft.Extensions │
│ .DependencyInjection) │
└────────────┬────────────┘
┌───────────────────────┼───────────────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Hardware │ │ Settings & │ │ Theme & Position │
│ Monitoring │ │ Notifications │ │ Management │
│ Service │ │ Services │ │ Services │
└────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘
│ │ │
└───────────────────────┼───────────────────────┘
┌───────────────────────┐
│ MainWidgetViewModel │
└───────────┬───────────┘
┌───────────────────────┐
│ MainWindow (WPF UI) │
│ Glassmorphism XAML │
└───────────────────────┘
```
## Key Architectural Principles
1. **Non-Blocking Telemetry Polling**:
- `HardwareMonitoringService` executes hardware polling on background tasks via `PeriodicTimer` and `CancellationToken`.
- Never blocks the WPF UI thread (`Dispatcher.InvokeAsync` marshals updates cleanly).
2. **Non-Elevated Safe Fallbacks**:
- Standard user mode startup.
- If `LibreHardwareMonitorLib` kernel driver access is denied without Admin rights, it automatically falls back to `PerformanceCounter`, WMI, `NetworkInterface`, and `System.Diagnostics` without crashing.
3. **Memory Optimization**:
- `CircularBuffer<T>` allocates fixed-size arrays for 60s/300s/900s history arrays.
- Zero endless GC allocations during long runtime sessions.
4. **Custom WPF Drawing Controls**:
- `SparklineControl` and `ProgressRingControl` derive directly from `FrameworkElement` using `DrawingContext`, bypassing heavy WPF layout trees for rendering.