diff --git a/TV Player WPF/App.xaml b/TV Player WPF/App.xaml
index 4ace1b4..532066b 100644
--- a/TV Player WPF/App.xaml
+++ b/TV Player WPF/App.xaml
@@ -1,9 +1,12 @@
-
+
+
+
+
+
diff --git a/TV Player WPF/Assets/GroupButtonStyle.xaml b/TV Player WPF/Assets/GroupButtonStyle.xaml
new file mode 100644
index 0000000..6ab952a
--- /dev/null
+++ b/TV Player WPF/Assets/GroupButtonStyle.xaml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TV Player WPF/BooleanToVisibilityConverter.cs b/TV Player WPF/BooleanToVisibilityConverter.cs
new file mode 100644
index 0000000..08b741b
--- /dev/null
+++ b/TV Player WPF/BooleanToVisibilityConverter.cs
@@ -0,0 +1,26 @@
+using System.Windows;
+using System.Windows.Data;
+
+namespace TV_Player
+{
+ public class BooleanToVisibilityConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (value is Boolean && (bool)value)
+ {
+ return Visibility.Visible;
+ }
+ return Visibility.Collapsed;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (value is Visibility && (Visibility)value == Visibility.Visible)
+ {
+ return true;
+ }
+ return false;
+ }
+ }
+}
diff --git a/TV Player WPF/EnumToBooleanConverter.cs b/TV Player WPF/EnumToBooleanConverter.cs
deleted file mode 100644
index 1205a56..0000000
--- a/TV Player WPF/EnumToBooleanConverter.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Data;
-
-namespace TV_Player
-{
- public class EnumToBooleanConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return value.Equals(parameter);
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return value.Equals(true) ? parameter : Binding.DoNothing;
- }
- }
-}
diff --git a/TV Player WPF/GroupButton.cs b/TV Player WPF/GroupButton.cs
new file mode 100644
index 0000000..0b8f9c1
--- /dev/null
+++ b/TV Player WPF/GroupButton.cs
@@ -0,0 +1,37 @@
+using System.Windows;
+using System.Windows.Controls;
+
+namespace TV_Player
+{
+ ///
+ /// Interaction logic for GroupButton.xaml
+ ///
+ public partial class GroupButton : UserControl
+ {
+ public static readonly DependencyProperty GroupNameProperty =
+ DependencyProperty.Register(
+ "GroupName", // Name of the property
+ typeof(string), // Type of the property
+ typeof(GroupButton), // Type of the owner class
+ new PropertyMetadata(string.Empty) // Default value
+ );
+ public string GroupName
+ {
+ get { return (string)GetValue(GroupNameProperty); }
+ set { SetValue(GroupNameProperty, value); }
+ }
+
+ public static readonly DependencyProperty ProgramsCountProperty =
+ DependencyProperty.Register(
+ "ProgramsCount", // Name of the property
+ typeof(string), // Type of the property
+ typeof(GroupButton), // Type of the owner class
+ new PropertyMetadata(string.Empty) // Default value
+ );
+ public string ProgramsCount
+ {
+ get { return (string)GetValue(ProgramsCountProperty); }
+ set { SetValue(ProgramsCountProperty, value); }
+ }
+ }
+}
diff --git a/TV Player WPF/GroupButton.xaml b/TV Player WPF/GroupButton.xaml
deleted file mode 100644
index 651f58f..0000000
--- a/TV Player WPF/GroupButton.xaml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Programs
-
-
-
-
-
diff --git a/TV Player WPF/GroupButton.xaml.cs b/TV Player WPF/GroupButton.xaml.cs
deleted file mode 100644
index d9985fb..0000000
--- a/TV Player WPF/GroupButton.xaml.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Windows.Controls;
-
-namespace TV_Player
-{
- ///
- /// Interaction logic for GroupButton.xaml
- ///
- public partial class GroupButton : UserControl
- {
- public GroupButton(string groupName,int programsFound)
- {
- InitializeComponent();
- this.groupName.Text = groupName;
- this.programsFound.Text = programsFound.ToString();
- }
- }
-}
diff --git a/TV Player WPF/MainWindow.xaml b/TV Player WPF/MainWindow.xaml
index fbe86c2..a1028ce 100644
--- a/TV Player WPF/MainWindow.xaml
+++ b/TV Player WPF/MainWindow.xaml
@@ -6,6 +6,9 @@
xmlns:local="clr-namespace:TV_Player"
mc:Ignorable="d"
Title="TV" Height="450" Width="800">
+
+
+
@@ -13,6 +16,15 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/TV Player WPF/ProgramsGroupGrid.xaml b/TV Player WPF/ProgramsGroupGrid.xaml
index 344bc9e..b3aa5a4 100644
--- a/TV Player WPF/ProgramsGroupGrid.xaml
+++ b/TV Player WPF/ProgramsGroupGrid.xaml
@@ -2,20 +2,23 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:TV_Player"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:tv_player="clr-namespace:TV_Player"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
-
-
+
+
+
+
+
-
+
diff --git a/TV Player WPF/VideoPlayer.xaml b/TV Player WPF/VideoPlayer.xaml
index fc1456b..38d5021 100644
--- a/TV Player WPF/VideoPlayer.xaml
+++ b/TV Player WPF/VideoPlayer.xaml
@@ -19,7 +19,7 @@
-
+
diff --git a/TV Player WPF/VideoPlayer.xaml.cs b/TV Player WPF/VideoPlayer.xaml.cs
index 93a74b9..ad153f1 100644
--- a/TV Player WPF/VideoPlayer.xaml.cs
+++ b/TV Player WPF/VideoPlayer.xaml.cs
@@ -18,15 +18,15 @@ namespace TV_Player
typeof(VideoPlayer), // Type of the owner class
new PropertyMetadata(string.Empty) // Default value
);
-
- LibVLC _libVLC;
- MediaPlayer _mediaPlayer;
-
public string SourceUrl
{
get { return (string)GetValue(SourceUrlProperty); }
- set { SetValue(SourceUrlProperty, value);}
+ set { SetValue(SourceUrlProperty, value); }
}
+
+ private LibVLC _libVLC;
+ private MediaPlayer _mediaPlayer;
+
public VideoPlayer()
{
InitializeComponent();
@@ -74,7 +74,7 @@ namespace TV_Player
VideoView.MediaPlayer.Play(media);
}
}
-
+
private void MyUserControl_MouseDown(object sender, MouseButtonEventArgs e)
{
diff --git a/TV Player WPF/ViewModels/MainViewModel.cs b/TV Player WPF/ViewModels/MainViewModel.cs
index 06fb2c9..a0b0b77 100644
--- a/TV Player WPF/ViewModels/MainViewModel.cs
+++ b/TV Player WPF/ViewModels/MainViewModel.cs
@@ -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();
}
}
}
diff --git a/TV Player WPF/ViewModels/PlayerViewModel.cs b/TV Player WPF/ViewModels/PlayerViewModel.cs
index e9998af..eae2a63 100644
--- a/TV Player WPF/ViewModels/PlayerViewModel.cs
+++ b/TV Player WPF/ViewModels/PlayerViewModel.cs
@@ -23,7 +23,7 @@ namespace TV_Player
{
_currentProgram = selectedProgram;
BackCommand = new RelayCommand(OnButtonBackClick);
-
+ TVPlayerViewModel.Instance.TopPanelVisible(false);
}
private void OnButtonBackClick()
diff --git a/TV Player WPF/ViewModels/ProgramsGroupViewModel.cs b/TV Player WPF/ViewModels/ProgramsGroupViewModel.cs
index 2bb218a..ea8dccf 100644
--- a/TV Player WPF/ViewModels/ProgramsGroupViewModel.cs
+++ b/TV Player WPF/ViewModels/ProgramsGroupViewModel.cs
@@ -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()
diff --git a/TV Player WPF/ViewModels/ProgramsListViewModel.cs b/TV Player WPF/ViewModels/ProgramsListViewModel.cs
index a34b92e..d8c44f0 100644
--- a/TV Player WPF/ViewModels/ProgramsListViewModel.cs
+++ b/TV Player WPF/ViewModels/ProgramsListViewModel.cs
@@ -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()
diff --git a/TV Player WPF/ViewModels/TVPlayerViewModel.cs b/TV Player WPF/ViewModels/TVPlayerViewModel.cs
index c62fa28..6c60158 100644
--- a/TV Player WPF/ViewModels/TVPlayerViewModel.cs
+++ b/TV Player WPF/ViewModels/TVPlayerViewModel.cs
@@ -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)