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