How puneet-swarup/battery-guardian works
Battery Guardian is a Windows tray application for monitoring battery state and prompting the user to unplug or connect power. Its principal loop refreshes readings, evaluates configured thresholds, and presents repeatable alerts; users can also refresh, snooze, and change settings. The README also documents battery-health reporting and release checks. MainWindow’s excerpt is partial, so links to capabilities whose invocation is not visible are omitted; health collection and toast delivery are shown only where their sampled implementations support them.
Main entry points: MainWindow.xaml.cs Main window and tray · App.xaml.cs Application startup · BatteryHealthService.cs Health capacity query · SettingsWindow.xaml.cs Settings window
Components 18
Application UI
- Application startup
App.xaml.cs - Main window and tray
MainWindow.xaml.cs - Settings window
SettingsWindow.xaml.cs
Battery monitoring
- Battery readings
MainWindow.xaml.cs - Health capacity query
BatteryHealthService.cs - Health status calculation
BatteryHealthInfo.cs - Threshold evaluation
BatteryAlertEvaluator.cs
Alerts
- Toast delivery
ToastService.cs
Settings and support
- Settings model
Settings.cs - Local settings file
- Diagnostic logging
DiagnosticLog.cs - Local log files
- Release checker
UpdateService.cs
Other components
- User
- Windows battery and WMI
- GitHub Releases API
- Windows notifications
- Speech and beep
Connections 19
- User → Main window and tray: opens and controls
- Application startup → Main window and tray: activates
- Main window and tray → Battery readings: refreshes
- Battery readings → Windows battery and WMI: reads status
- Main window and tray → Threshold evaluation: evaluates thresholds
- Main window and tray → Settings model: loads and saves
- Settings model → Local settings file: reads and writes
- Main window and tray → Settings window: opens settings
- Settings window → Main window and tray: returns edits
- Main window and tray → Toast delivery: shows alerts
- Toast delivery → Windows notifications: dispatches toast
- Main window and tray → Speech and beep: plays and speaks
- Main window and tray → Release checker: checks releases
- Release checker → GitHub Releases API: queries latest release
- Health capacity query → Windows battery and WMI: queries capacities
- Health capacity query → Health status calculation: creates health data
- Main window and tray → Diagnostic logging: records diagnostics
- Diagnostic logging → Local log files: appends entries
- Application startup → Local log files: records crashes