A Windows desktop application built with WinUI 3 and .NET 6 to monitor and track screen time usage across different applications.
- Active Window Tracking: Monitors which applications are currently in focus
- Time Calculation: Tracks duration spent in each application
- Data Storage: Local SQLite database to store usage data
- Dashboard: Shows today's usage statistics and top applications
- Reports: Historical data viewing with date range selection
- Settings: Configure monitoring preferences and application categories
- Daily/Weekly/Monthly Reports: Enhanced analytics with period selection and summary cards
- Usage Limits & Notifications: Set daily limits with toast notifications when approaching or exceeding limits
- System Tray Integration: Service framework for running in background with tray icon
- Break Reminders: Periodic notifications to take breaks with configurable intervals
- Website Tracking: Monitor browser tabs and websites
- Detailed Analytics: Trends, patterns, most productive hours
- Data Export: Export reports to CSV/PDF
This application follows Microsoft's recommended patterns and best practices:
- MVVM Pattern: Using CommunityToolkit.Mvvm for clean separation of concerns
- Dependency Injection: Microsoft.Extensions.DependencyInjection for service management
- Entity Framework Core: For data persistence with SQLite
- Windows App SDK: Latest WinUI 3 framework for modern Windows apps
ScreenTimeMonitor/
├── App.xaml & App.xaml.cs # Application entry point with DI setup
├── MainWindow.xaml & .cs # Main application window
├── Models/ # Data models (Application, UsageSession, DailySummary)
├── ViewModels/ # MVVM ViewModels using CommunityToolkit.Mvvm
├── Views/ # XAML pages (Dashboard, Reports, Settings)
├── Services/ # Business logic services
│ ├── WindowMonitoringService # Windows API integration for active window tracking
│ ├── DataService # Entity Framework data access
│ ├── SettingsService # User preferences management
│ └── NotificationService # Toast notifications
├── Data/ # Entity Framework DbContext
├── Converters/ # XAML value converters
└── Assets/ # Application icons and resources
- WinUI 3 (Windows App SDK 1.4)
- .NET 6 (Windows-specific)
- Entity Framework Core with SQLite
- CommunityToolkit.Mvvm for MVVM implementation
- Microsoft.Extensions.DependencyInjection for IoC
- Windows APIs for window monitoring (user32.dll)
- Visual Studio Code with C# Dev Kit extension
- .NET 6.0+ SDK
- Windows 10 version 1809+ or Windows 11
-
Restore packages:
dotnet restore
-
Build the project:
dotnet build
-
Run the application:
dotnet run
The project includes VS Code configuration files:
.vscode/launch.json- Debug configuration.vscode/tasks.json- Build tasks
The application uses SQLite for local data storage. The database file is created automatically in the user's local app data folder:
- Location:
%LOCALAPPDATA%/Packages/[AppId]/LocalState/ScreenTimeMonitor.db
- Applications: Stores information about monitored applications
- UsageSessions: Records individual usage sessions with start/end times
- DailySummaries: Aggregated daily statistics
- All data is stored locally on your device
- No data is transmitted to external servers
- The application only monitors active window information
- Users can control data retention periods in settings
This project follows Microsoft's coding standards and best practices:
- Clean Code principles
- SOLID design patterns
- Comprehensive error handling
- Proper async/await usage
- Modern C# features
Licensed under the MIT License - see LICENSE file for details.
Built following Microsoft Learn documentation and best practices: