Got WPF version work

This commit is contained in:
Vova
2024-01-18 17:42:44 +02:00
parent df51ee3ad6
commit 10b4146772
64 changed files with 866 additions and 411 deletions
+38
View File
@@ -0,0 +1,38 @@
using System.Windows.Input;
namespace TV_Player.MAUI
{
public class ProgramViewModel : ObservableViewModelBase
{
private List<M3UInfo> _programs;
public List<M3UInfo> Programs
{
get => _programs;
set => SetProperty(ref _programs, value);
}
public M3UInfo SelectedItem { get; set; }
public ICommand ItemSelectedCommand { get; }
public ProgramViewModel(GroupInfo groupInfo)
{
ItemSelectedCommand = new Command(OnItemSelected);
ProgramsData.Instance.AllPrograms.Subscribe(x=>Programs = x.Where(p=>p.GroupTitle== groupInfo.Name).ToList());
}
private void OnItemSelected()
{
var navigation = (INavigation)Application.Current.MainPage.Navigation;
var playerViewModel = new PlayerViewModel(SelectedItem);
// Create a new SecondPage and set its BindingContext to the ViewModel
var playerPage = new PlayerPage
{
BindingContext = playerViewModel
};
// Navigate to the OtherPage
navigation.PushAsync(playerPage);
}
}
}