1e8e444376
- Added PlaylistsGroupViewModel to manage playlists and selection. - Introduced ProgramsGroupViewModel for handling program groups and subscriptions. - Created ProgramsListViewModel to manage individual program listings. - Developed SettingsViewModel for user settings including playlist management. - Implemented TVPlayerViewModel as the main view model coordinating screens and data. - Added PlayerView for video playback with LibVLC integration. - Created XAML views for PlaylistsGroup, ProgramsGroup, ProgramsList, and Settings. - Added sample M3U playlist for testing. - Documented WPF build instructions and project structure in WPF-BUILD.md. - Configured global.json for .NET SDK versioning.
5.7 KiB
5.7 KiB
WPF Build Instructions
Overview
This is a Windows TV Player application built with .NET WPF (Windows Presentation Foundation) targeting net8.0-windows.
Prerequisites
System Requirements
- Windows 10 Build 19041 or later (or Windows 11)
- Visual Studio 2022 17.0 or later with:
- .NET desktop development workload
- Windows Forms development tools
- XAML tools
Development Setup
- .NET 8 SDK or later
- Visual Studio 2022 or JetBrains Rider
Installation
Clone and Open Project
cd "TV Player WPF"
Restore Dependencies
dotnet restore
Building
Build for Release
dotnet build --configuration Release --framework net8.0-windows10.0.19041.0
Build for Debug
dotnet build --configuration Debug --framework net8.0-windows10.0.19041.0
Build for Distribution
dotnet publish --configuration Release --framework net8.0-windows10.0.19041.0 -p:PublishProfile=FolderProfile
Running
Run from Visual Studio
- Open
TV Player WPF.csprojin Visual Studio - Press F5 to start with debugging
- Press Ctrl+F5 to start without debugging
Run from Command Line
dotnet run --configuration Debug --framework net8.0-windows10.0.19041.0
Run Published Application
# After publishing
./bin/Release/net8.0-windows10.0.19041.0/publish/TV Player WPF.exe
Project Structure
TV Player WPF/
├── ViewModels/ # MVVM ViewModels with INotifyPropertyChanged
│ ├── MainViewModel.cs # Main window logic
│ ├── PlayerViewModel.cs
│ ├── SettingsViewModel.cs
│ └── ...
├── PlaylistWorker/ # M3U and EPG parsing
│ ├── M3UParser.cs
│ └── M3UInfo.cs
├── MainWindow.xaml # Main UI
├── VideoPlayer.xaml # Video player UI
├── Assets/ # Application resources
│ ├── AppStyle.xaml
│ └── Images/
└── TV Player WPF.csproj # Project file
Configuration
Playlist Settings
The application loads playlists from configured URLs:
- Default M3U URL: Configured in TVPlayerViewModel
- EPG URL: Extracted from M3U file or set in settings
To change the playlist:
- Go to Settings in the application
- Enter the M3U playlist URL
- Save settings
Settings are persisted in AppData.
Application Settings
User preferences are stored in:
%localappdata%\TV_Player\settings.json
Key Features
MVVM Architecture
- Proper separation of concerns with ViewModels
- Data binding through INotifyPropertyChanged
- Commands for user interactions
Error Handling
- Comprehensive exception handling with logging
- User-friendly error messages
- Debug output for troubleshooting
Resource Management
- Proper disposal of resources
- No memory leaks from subscriptions
- Clean shutdown sequence
Performance
- Asynchronous network operations
- Lazy-loaded playlist data
- Caching of EPG information
Keyboard Shortcuts
- Escape: Exit application
- Backspace: Go back/navigate
- F11: Toggle fullscreen
- Arrow Keys: Navigate UI
Registry Settings
The application may create registry entries in:
HKEY_CURRENT_USER\Software\TV_Player
These include:
- Last played channel
- Window state and position
- User preferences
Troubleshooting
Application Won't Start
- Check .NET 8 is installed:
dotnet --version - Verify Windows version:
winver(must be 19041+) - Check event viewer for errors:
eventvwr.msc
Playlist Download Fails
- Check network connectivity
- Verify URL is correct
- Check firewall settings allow outbound HTTP/HTTPS
- Check Debug output for detailed error
Video Won't Play
- Verify stream URL is valid
- Check network connection to stream server
- Verify media format is supported
- Check sufficient bandwidth available
Performance Issues
- Check Task Manager for CPU/memory usage
- Disable hardware acceleration in settings if available
- Clear EPG cache and reload
- Close unnecessary background applications
Development
Debug Logging
When running in Debug configuration, detailed logs are sent to Output window in Visual Studio.
Enable more detailed logging:
- Open Debug > Windows > Output
- Select "Debug" from dropdown
Code Organization
- ViewModels: Business logic and state management
- Views: XAML UI definitions
- PlaylistWorker: Network and parsing operations
- Assets: Application resources and styling
Common Tasks
Add New ViewModel
public class MyViewModel : ObservableViewModelBase
{
private string _property;
public string Property
{
get => _property;
set => SetProperty(ref _property, value);
}
}
Handle Exceptions
try
{
await FetchPlaylistAsync();
}
catch (HttpRequestException ex)
{
Debug.WriteLine($"Network error: {ex.Message}");
// Show user-friendly error
}
Publishing
Create Installer
Use Visual Studio Setup Project or:
dotnet publish --configuration Release \
--framework net8.0-windows10.0.19041.0 \
--output ./publish
Then package with your installer tool (NSIS, WiX, etc.)
Self-Contained Deployment
dotnet publish --configuration Release \
--framework net8.0-windows10.0.19041.0 \
--self-contained \
--output ./publish-standalone
This creates an executable that doesn't require .NET runtime installed.
Performance Optimization
- Use Release build for distribution
- Enable ReadyToRun:
-p:PublishReadyToRun=true - Enable PublishTrimmed:
-p:PublishTrimmed=true(advanced) - Use PublishAot for maximum performance (requires additional testing)
Version History
See CHANGELOG.md for detailed version information.