Refactor code structure for improved readability and maintainability

This commit is contained in:
Vladimir
2026-03-22 13:19:49 +02:00
parent 689450393b
commit 36c2970709
9 changed files with 238 additions and 199 deletions
@@ -1,43 +1,43 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="TV_Player.AvaloniaApp.Views.ProgramsGroupView">
<Grid RowDefinitions="Auto,*">
<!-- Debug Info Header -->
<Border Grid.Row="0" Background="#1a1a2e" Padding="16" Margin="0,0,0,4">
<TextBlock Text="{Binding Programs.Count, StringFormat='Groups Loaded: {0}'}"
Foreground="#EAB308"
FontSize="14"
FontWeight="Bold" />
</Border>
<!-- Groups List -->
<ScrollViewer Grid.Row="1">
<ItemsControl ItemsSource="{Binding Programs}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="260"
Height="140"
Margin="10"
Padding="18"
CornerRadius="16"
Background="#AA111827"
BorderBrush="#EAB308"
BorderThickness="2"
Command="{Binding DataContext.SelectGroupCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}">
<StackPanel Spacing="8">
<TextBlock Text="{Binding Name}" FontSize="24" FontWeight="Bold" TextWrapping="Wrap" />
<TextBlock Text="{Binding Count, StringFormat='Channels: {0}'}" Foreground="#D1D5DB" />
</StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid VerticalAlignment="Center">
<ListBox ItemsSource="{Binding Programs}"
Background="Transparent"
BorderThickness="0"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="4" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Button Width="170"
Height="130"
Margin="8"
Background="#B0000000"
BorderBrush="Yellow"
BorderThickness="2"
Command="{Binding DataContext.SelectGroupCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="6">
<TextBlock Text="{Binding Name}"
Foreground="White"
FontSize="20"
FontWeight="Bold"
TextWrapping="Wrap"
HorizontalAlignment="Center"
TextAlignment="Center" />
<TextBlock Text="{Binding Count}"
Foreground="White"
FontSize="16"
HorizontalAlignment="Center" />
</StackPanel>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>