feat: Implement Playlists and Programs Management

- 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.
This commit is contained in:
Vladimir
2026-03-22 12:11:24 +02:00
parent a6ec011e79
commit 1e8e444376
82 changed files with 2970 additions and 1687 deletions
@@ -0,0 +1,51 @@
using System.Collections.ObjectModel;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using Avalonia.Threading;
namespace TV_Player.AvaloniaApp.ViewModels;
public class ProgramsListViewModel : TV_Player.ObservableViewModelBase, IDisposable
{
private readonly IDisposable _programSubscription;
private ObservableCollection<M3UInfo> _programs = new();
public ObservableCollection<M3UInfo> Programs
{
get => _programs;
set => SetProperty(ref _programs, value);
}
public ICommand SelectProgramCommand { get; }
public ProgramsListViewModel(GroupInfo groupInfo)
{
SelectProgramCommand = new RelayCommand<M3UInfo>(OnItemSelected);
_programSubscription = TVPlayerViewModel.Instance.CurrentProgramsData!
.AllPrograms
.Subscribe(newPrograms =>
{
var filteredPrograms = newPrograms
.Where(p => p.GroupTitle == groupInfo.Name && !string.IsNullOrWhiteSpace(p.Url))
.ToList();
Dispatcher.UIThread.Post(() =>
{
Programs = new ObservableCollection<M3UInfo>(filteredPrograms);
});
});
}
private void OnItemSelected(M3UInfo? program)
{
if (program == null)
return;
TVPlayerViewModel.Instance.ShowPlayerScreen(program);
}
public void Dispose()
{
_programSubscription.Dispose();
}
}