Design
This commit is contained in:
@@ -21,10 +21,16 @@
|
|||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Visibility="{Binding IsTopPanelVisible,Converter={StaticResource BooleanToVisibilityConverterKey}}" >
|
<Grid Visibility="{Binding IsTopPanelVisible,Converter={StaticResource BooleanToVisibilityConverterKey}}" Height="70">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition Width="70"/>
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<Button Height="50" Width="50" Margin="10,0,0,0" Style="{DynamicResource ButtonGear}" />
|
<Button Height="50" Width="50" Margin="10,0,0,0" Style="{DynamicResource ButtonGear}" />
|
||||||
<Button Height="50" Width="50" Margin="10,0,0,0" Style="{DynamicResource ButtonBack}" Command="{Binding BackCommand}" />
|
<Button Grid.Column="1" Height="50" Width="50" Margin="10,0,0,0" Style="{DynamicResource ButtonBack}" Command="{Binding BackCommand}" />
|
||||||
</StackPanel>
|
<TextBlock Grid.Column="2" FontSize="20" Foreground="White" Text="{Binding TopPanelTitle}" HorizontalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
<ContentControl Grid.Row="1" Name="ControlContainer" Content="{Binding Control}" />
|
<ContentControl Grid.Row="1" Name="ControlContainer" Content="{Binding Control}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -7,15 +7,20 @@
|
|||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid x:Name="groupsGrid">
|
<Grid x:Name="groupsGrid">
|
||||||
<ScrollViewer>
|
<ScrollViewer>
|
||||||
<ListBox ItemsSource="{Binding Programs}"
|
<ListBox ItemsSource="{Binding Programs}" Background="Transparent"
|
||||||
SelectionMode="Single"
|
SelectionMode="Single"
|
||||||
SelectedItem="{Binding SelectedItem}"
|
SelectedItem="{Binding SelectedItem}"
|
||||||
SelectionChanged="ListBox_SelectionChanged">
|
SelectionChanged="ListBox_SelectionChanged">
|
||||||
|
<ListBox.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<UniformGrid Rows="4" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListBox.ItemsPanel>
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Image Source="{Binding Logo}" Width="50" Height="50"/>
|
<Image Source="{Binding Logo}" Width="50" Height="50" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Text="{Binding Name}"/>
|
<TextBlock Text="{Binding Name}" FontSize="15" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
|
|||||||
@@ -12,15 +12,13 @@
|
|||||||
<StackPanel Panel.ZIndex="10" IsHitTestVisible="True" Background="#01FFFFFF"
|
<StackPanel Panel.ZIndex="10" IsHitTestVisible="True" Background="#01FFFFFF"
|
||||||
HorizontalAlignment="Stretch" MouseLeftButtonDown="MyUserControl_MouseDown"
|
HorizontalAlignment="Stretch" MouseLeftButtonDown="MyUserControl_MouseDown"
|
||||||
TouchDown="MyUserControl_TouchDown" >
|
TouchDown="MyUserControl_TouchDown" >
|
||||||
<Grid x:Name="overlayPanel" Visibility="Collapsed" >
|
<Grid x:Name="overlayPanel" Visibility="Collapsed" Background="#70000000" Height="70" >
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition Width="70"/>
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button Height="50" Width="50" Margin="10,0,0,0" Style="{DynamicResource ButtonBack}" Command="{Binding BackCommand}" />
|
<Button Height="50" Width="50" Margin="10,0,0,0" Style="{DynamicResource ButtonBack}" Command="{Binding BackCommand}" />
|
||||||
<Button Grid.Column="1" Content="Pause" HorizontalAlignment="Stretch" Click="PauseButton_Click" />
|
<TextBlock Grid.Column="1" FontSize="20" Foreground="White" Text="{Binding TopPanelTitle}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</vlc:VideoView>
|
</vlc:VideoView>
|
||||||
|
|||||||
@@ -19,17 +19,18 @@ namespace TV_Player
|
|||||||
set => SetProperty(ref _isTopPanelVisible, value);
|
set => SetProperty(ref _isTopPanelVisible, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string _topPaneTitle;
|
||||||
|
public string TopPanelTitle
|
||||||
|
{
|
||||||
|
get => _topPaneTitle;
|
||||||
|
set => SetProperty(ref _topPaneTitle, value);
|
||||||
|
}
|
||||||
|
|
||||||
public Action ButtonBackAction { get; set; }
|
public Action ButtonBackAction { get; set; }
|
||||||
public ICommand BackCommand { get; }
|
public ICommand BackCommand { get; }
|
||||||
|
|
||||||
public MainViewModel()
|
public MainViewModel()
|
||||||
{
|
{
|
||||||
var vm = new ProgramsGroupViewModel();
|
|
||||||
|
|
||||||
var control = new ProgramsGroupGrid();
|
|
||||||
control.DataContext = vm;
|
|
||||||
Control = control;
|
|
||||||
|
|
||||||
BackCommand = new RelayCommand(OnButtonBackClick);
|
BackCommand = new RelayCommand(OnButtonBackClick);
|
||||||
}
|
}
|
||||||
private void OnButtonBackClick()
|
private void OnButtonBackClick()
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ namespace TV_Player
|
|||||||
set => SetProperty(ref _currentProgram, value);
|
set => SetProperty(ref _currentProgram, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string _topPaneTitle;
|
||||||
|
public string TopPanelTitle
|
||||||
|
{
|
||||||
|
get => _topPaneTitle;
|
||||||
|
set => SetProperty(ref _topPaneTitle, value);
|
||||||
|
}
|
||||||
|
|
||||||
public M3UInfo SelectedItem { get; set; }
|
public M3UInfo SelectedItem { get; set; }
|
||||||
public ICommand BackCommand { get; }
|
public ICommand BackCommand { get; }
|
||||||
|
|
||||||
@@ -23,7 +30,8 @@ namespace TV_Player
|
|||||||
{
|
{
|
||||||
_currentProgram = selectedProgram;
|
_currentProgram = selectedProgram;
|
||||||
BackCommand = new RelayCommand(OnButtonBackClick);
|
BackCommand = new RelayCommand(OnButtonBackClick);
|
||||||
TVPlayerViewModel.Instance.TopPanelVisible(false);
|
TVPlayerViewModel.Instance.TopPanelVisible(false, selectedProgram.Name);
|
||||||
|
TopPanelTitle = selectedProgram.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnButtonBackClick()
|
private void OnButtonBackClick()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace TV_Player
|
|||||||
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
||||||
ProgramsData.Instance.GroupsInformation.Subscribe(x=>Programs = x);
|
ProgramsData.Instance.GroupsInformation.Subscribe(x=>Programs = x);
|
||||||
|
|
||||||
//TVPlayerViewModel.Instance.TopPanelVisible(true);
|
TVPlayerViewModel.Instance.TopPanelVisible(true, "Groups");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnItemSelected()
|
private void OnItemSelected()
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace TV_Player
|
|||||||
|
|
||||||
public ProgramsListViewModel(GroupInfo groupInfo)
|
public ProgramsListViewModel(GroupInfo groupInfo)
|
||||||
{
|
{
|
||||||
TVPlayerViewModel.Instance.TopPanelVisible(true);
|
TVPlayerViewModel.Instance.TopPanelVisible(true, groupInfo.Name);
|
||||||
ItemSelectedCommand = new RelayCommand(OnItemSelected);
|
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());
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
using CommunityToolkit.Mvvm.Input;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace TV_Player.ViewModels
|
namespace TV_Player.ViewModels
|
||||||
{
|
{
|
||||||
public class TVPlayerViewModel
|
public class TVPlayerViewModel
|
||||||
{
|
{
|
||||||
private readonly MainViewModel _mainViewModel;
|
private readonly MainViewModel _mainViewModel;
|
||||||
|
|
||||||
public Action ButtonBackAction { get; set; }
|
|
||||||
|
|
||||||
private static TVPlayerViewModel _instance;
|
public Action ButtonBackAction { get; set; }
|
||||||
|
|
||||||
|
private static TVPlayerViewModel? _instance;
|
||||||
public static TVPlayerViewModel Instance
|
public static TVPlayerViewModel Instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(_instance==null)
|
if (_instance == null)
|
||||||
_instance = new TVPlayerViewModel();
|
_instance = new TVPlayerViewModel();
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
@@ -24,16 +22,29 @@ namespace TV_Player.ViewModels
|
|||||||
public TVPlayerViewModel()
|
public TVPlayerViewModel()
|
||||||
{
|
{
|
||||||
_mainViewModel = new MainViewModel();
|
_mainViewModel = new MainViewModel();
|
||||||
var mainWindow=new MainWindow();
|
var mainWindow = new MainWindow();
|
||||||
mainWindow.DataContext = _mainViewModel;
|
mainWindow.DataContext = _mainViewModel;
|
||||||
|
|
||||||
mainWindow.Show();
|
mainWindow.Show();
|
||||||
_instance = this;
|
_instance = this;
|
||||||
|
|
||||||
|
ShowInitialScreen();
|
||||||
}
|
}
|
||||||
public void TopPanelVisible(bool value)
|
|
||||||
|
private void ShowInitialScreen()
|
||||||
|
{
|
||||||
|
var vm = new ProgramsGroupViewModel();
|
||||||
|
|
||||||
|
var control = new ProgramsGroupGrid();
|
||||||
|
control.DataContext = vm;
|
||||||
|
|
||||||
|
SetPageContext(control, vm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TopPanelVisible(bool value, string title)
|
||||||
{
|
{
|
||||||
_mainViewModel.IsTopPanelVisible = value;
|
_mainViewModel.IsTopPanelVisible = value;
|
||||||
|
_mainViewModel.TopPanelTitle = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBackButtonAction(Action action)
|
public void SetBackButtonAction(Action action)
|
||||||
|
|||||||
Reference in New Issue
Block a user