navigation menu & design
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Windows.Controls;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace TV_Player
|
||||
{
|
||||
@@ -11,6 +13,15 @@ namespace TV_Player
|
||||
set => SetProperty(ref _control, value);
|
||||
}
|
||||
|
||||
private bool _isTopPanelVisible;
|
||||
public bool IsTopPanelVisible{
|
||||
get => _isTopPanelVisible;
|
||||
set => SetProperty(ref _isTopPanelVisible, value);
|
||||
}
|
||||
|
||||
public Action ButtonBackAction { get; set; }
|
||||
public ICommand BackCommand { get; }
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
var vm = new ProgramsGroupViewModel();
|
||||
@@ -18,6 +29,12 @@ namespace TV_Player
|
||||
var control = new ProgramsGroupGrid();
|
||||
control.DataContext = vm;
|
||||
Control = control;
|
||||
|
||||
BackCommand = new RelayCommand(OnButtonBackClick);
|
||||
}
|
||||
private void OnButtonBackClick()
|
||||
{
|
||||
ButtonBackAction?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace TV_Player
|
||||
{
|
||||
_currentProgram = selectedProgram;
|
||||
BackCommand = new RelayCommand(OnButtonBackClick);
|
||||
|
||||
TVPlayerViewModel.Instance.TopPanelVisible(false);
|
||||
}
|
||||
|
||||
private void OnButtonBackClick()
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace TV_Player
|
||||
{
|
||||
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
||||
ProgramsData.Instance.GroupsInformation.Subscribe(x=>Programs = x);
|
||||
|
||||
//TVPlayerViewModel.Instance.TopPanelVisible(true);
|
||||
}
|
||||
|
||||
private void OnItemSelected()
|
||||
|
||||
@@ -18,8 +18,16 @@ namespace TV_Player
|
||||
|
||||
public ProgramsListViewModel(GroupInfo groupInfo)
|
||||
{
|
||||
TVPlayerViewModel.Instance.TopPanelVisible(true);
|
||||
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
||||
ProgramsData.Instance.AllPrograms.Subscribe(x=>Programs = x.Where(p=>p.GroupTitle== groupInfo.Name).ToList());
|
||||
ProgramsData.Instance.AllPrograms.Subscribe(x => Programs = x.Where(p => p.GroupTitle == groupInfo.Name).ToList());
|
||||
|
||||
TVPlayerViewModel.Instance.SetBackButtonAction(new Action(() =>
|
||||
{
|
||||
var programGroupViewModel = new ProgramsGroupViewModel();
|
||||
var conrtrol = new ProgramsGroupGrid();
|
||||
TVPlayerViewModel.Instance.SetPageContext(conrtrol, programGroupViewModel);
|
||||
}));
|
||||
}
|
||||
|
||||
private void OnItemSelected()
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
using System.Windows.Controls;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace TV_Player.ViewModels
|
||||
{
|
||||
public class TVPlayerViewModel
|
||||
{
|
||||
private readonly MainViewModel _mainViewModel;
|
||||
|
||||
public Action ButtonBackAction { get; set; }
|
||||
|
||||
private static TVPlayerViewModel _instance;
|
||||
public static TVPlayerViewModel Instance
|
||||
@@ -25,6 +29,16 @@ namespace TV_Player.ViewModels
|
||||
|
||||
mainWindow.Show();
|
||||
_instance = this;
|
||||
|
||||
}
|
||||
public void TopPanelVisible(bool value)
|
||||
{
|
||||
_mainViewModel.IsTopPanelVisible = value;
|
||||
}
|
||||
|
||||
public void SetBackButtonAction(Action action)
|
||||
{
|
||||
_mainViewModel.ButtonBackAction = action;
|
||||
}
|
||||
|
||||
public void SetPageContext(ContentControl control, object viewModel)
|
||||
|
||||
Reference in New Issue
Block a user