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
Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

+21 -23
View File
@@ -4,35 +4,33 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="TV_Player.AvaloniaApp.MainWindow" x:Class="TV_Player.AvaloniaApp.MainWindow"
mc:Ignorable="d" mc:Ignorable="d"
Width="1400" Width="800"
Height="860" Height="450"
MinWidth="980" MinWidth="800"
MinHeight="640" MinHeight="450"
Title="TV Player" Title="TV"
WindowState="{Binding CurrentWindowState}" WindowState="{Binding CurrentWindowState}"
Background="#0B1220"> SystemDecorations="None">
<Grid RowDefinitions="Auto,*"> <Grid RowDefinitions="Auto,*">
<Border IsVisible="{Binding IsTopPanelVisible}" <Grid.Background>
Background="#AA111827" <ImageBrush Source="/Assets/bkground.jpg" Stretch="UniformToFill" />
BorderBrush="#33FFFFFF" </Grid.Background>
BorderThickness="0,0,0,1"
Padding="20,14"> <Grid IsVisible="{Binding IsTopPanelVisible}" Height="80">
<Grid ColumnDefinitions="Auto,Auto,*,Auto,Auto"> <Grid ColumnDefinitions="80,80,*,80,80">
<Button Content="Settings" Command="{Binding SettingsCommand}" MinWidth="92" Margin="0,0,12,0" /> <Button Width="70" Height="70" Margin="10,0,0,0" Content="S" Command="{Binding SettingsCommand}" />
<Button Grid.Column="1" Content="Back" Command="{Binding BackCommand}" MinWidth="92" Margin="0,0,12,0" /> <Button Grid.Column="1" Width="70" Height="70" Margin="10,0,0,0" Content="B" Command="{Binding BackCommand}" />
<TextBlock Grid.Column="2" <TextBlock Grid.Column="2"
Text="{Binding TopPanelTitle}" Text="{Binding TopPanelTitle}"
FontSize="26" FontSize="30"
FontWeight="SemiBold"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" /> HorizontalAlignment="Center"
<Button Grid.Column="3" Content="Fullscreen" Command="{Binding FullscreenCommand}" MinWidth="110" Margin="0,0,12,0" /> Foreground="White" />
<Button Grid.Column="4" Content="Close" Command="{Binding CloseAppCommand}" MinWidth="92" /> <Button Grid.Column="3" Width="70" Height="70" Margin="10,0,0,0" Content="F" Command="{Binding FullscreenCommand}" />
<Button Grid.Column="4" Width="70" Height="70" Margin="10,0,0,0" Content="X" Command="{Binding CloseAppCommand}" />
</Grid> </Grid>
</Border> </Grid>
<Border Grid.Row="1" Padding="20"> <ContentControl Grid.Row="1" Content="{Binding CurrentViewModel}" />
<ContentControl Content="{Binding CurrentViewModel}" />
</Border>
</Grid> </Grid>
</Window> </Window>
@@ -25,4 +25,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\TV Player Core\TV Player Core.csproj" /> <ProjectReference Include="..\TV Player Core\TV Player Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**\*" />
</ItemGroup>
</Project> </Project>
+73 -53
View File
@@ -2,71 +2,91 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vlc="clr-namespace:LibVLCSharp.Avalonia;assembly=LibVLCSharp.Avalonia" xmlns:vlc="clr-namespace:LibVLCSharp.Avalonia;assembly=LibVLCSharp.Avalonia"
x:Class="TV_Player.AvaloniaApp.Views.PlayerView"> x:Class="TV_Player.AvaloniaApp.Views.PlayerView">
<Grid RowDefinitions="*,Auto" ColumnDefinitions="280,*"> <Grid>
<Border Grid.RowSpan="2" <vlc:VideoView x:Name="VideoView" />
Background="#AA111827"
Padding="16" <Grid Background="#01000000">
CornerRadius="16" <Grid.RowDefinitions>
IsVisible="{Binding ProgramGuideVisible}"> <RowDefinition Height="80" />
<StackPanel Spacing="10"> <RowDefinition Height="*" />
<TextBlock Text="Upcoming" FontSize="22" FontWeight="SemiBold" /> <RowDefinition Height="80" />
</Grid.RowDefinitions>
<Grid Background="#70000000">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="80" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<Button Width="70" Height="50" Margin="10,0,0,0" Content="B" Command="{Binding BackCommand}" />
<TextBlock Grid.Column="1" FontSize="20" Foreground="White" Text="{Binding TopPanelTitle}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Button Grid.Column="2" Width="50" Height="70" Margin="10,0,0,0" Content="F" Command="{Binding FullscreenCommand}" />
<Button Grid.Column="3" Width="70" Height="70" Margin="10,0,0,0" Content="X" Command="{Binding CloseAppCommand}" />
</Grid>
<Border Grid.Row="1"
Width="400"
HorizontalAlignment="Left"
Background="#B0000000"
IsVisible="{Binding ProgramGuideVisible}">
<ItemsControl ItemsSource="{Binding Programs}"> <ItemsControl ItemsSource="{Binding Programs}">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border Padding="8" Background="#1F2937" CornerRadius="10" Margin="0,0,0,8"> <StackPanel Orientation="Vertical" Margin="6,2">
<StackPanel Spacing="4"> <TextBlock Text="{Binding Title}" TextWrapping="Wrap" FontSize="15" Foreground="White" TextAlignment="Left" Margin="1,0,1,2" />
<TextBlock Text="{Binding Title}" TextWrapping="Wrap" /> <StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Spacing="8"> <TextBlock Text="{Binding StartTime, StringFormat='{}{0:HH:mm}'}" FontSize="12" Foreground="White" Margin="1,0,1,2" />
<TextBlock Text="{Binding StartTime, StringFormat='{}{0:HH:mm}'}" /> <TextBlock Text="{Binding EndTime, StringFormat='{}{0:HH:mm}'}" FontSize="12" Foreground="White" Margin="10,0,1,2" />
<TextBlock Text="-" />
<TextBlock Text="{Binding EndTime, StringFormat='{}{0:HH:mm}'}" />
</StackPanel>
</StackPanel> </StackPanel>
</Border> </StackPanel>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
</StackPanel> </Border>
</Border>
<Border Grid.Column="1" Background="#0F172A" CornerRadius="20" Padding="20" Margin="16,0,0,16"> <Grid Grid.Row="2" Background="#B0000000">
<Grid RowDefinitions="Auto,*,Auto"> <Grid.ColumnDefinitions>
<TextBlock Text="{Binding TopPanelTitle}" FontSize="30" FontWeight="Bold" TextAlignment="Center" Margin="0,0,0,16" /> <ColumnDefinition Width="180" />
<Grid Grid.Row="1"> <ColumnDefinition Width="*" />
<vlc:VideoView x:Name="VideoView" /> <ColumnDefinition Width="100" />
<Border Background="#66000000" Padding="14" CornerRadius="12" </Grid.ColumnDefinitions>
HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="20"
IsVisible="{Binding HasPlaybackStatus}"> <StackPanel Orientation="Horizontal">
<StackPanel Spacing="8" MaxWidth="720"> <Button Width="50" Height="70" Margin="10,0,10,0" Content="-" Command="{Binding PreviousCommand}" />
<TextBlock Text="{Binding PlaybackStatus}" TextWrapping="Wrap" TextAlignment="Center" /> <TextBlock FontSize="15" Foreground="White" Text="Ch" HorizontalAlignment="Center" VerticalAlignment="Center" />
<SelectableTextBlock Text="{Binding StreamUrl}" TextWrapping="Wrap" IsVisible="False" /> <Button Width="50" Height="70" Margin="10,0,10,0" Content="+" Command="{Binding NextCommand}" />
</StackPanel>
<Button Grid.Column="1"
Background="#0F000000"
BorderThickness="0"
IsVisible="{Binding IsProgramInfoVisible}"
Command="{Binding ShowProgramListCommand}">
<StackPanel>
<TextBlock FontSize="20" Foreground="White" Text="{Binding ProgramGuideText}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontSize="15" Foreground="White" Text="{Binding StartProgram}" />
<ProgressBar Height="10" Foreground="Yellow" Value="{Binding DurationValue}" Maximum="100" Width="400" VerticalAlignment="Center" />
<TextBlock FontSize="15" Foreground="White" Text="{Binding EndProgram}" />
</StackPanel> </StackPanel>
</Border>
</Grid>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Spacing="12">
<Button Content="Previous" Command="{Binding PreviousCommand}" />
<Button Content="Open Externally" Command="{Binding OpenStreamCommand}" />
<Button Content="Next" Command="{Binding NextCommand}" />
</StackPanel>
</Grid>
</Border>
<Border Grid.Row="1" Grid.Column="1" Background="#AA111827" Padding="16" CornerRadius="16">
<Grid ColumnDefinitions="Auto,*,Auto,Auto,Auto,Auto" VerticalAlignment="Center">
<Button Content="Back" Command="{Binding BackCommand}" Margin="0,0,12,0" />
<StackPanel Grid.Column="1" IsVisible="{Binding IsProgramInfoVisible}" Spacing="6">
<TextBlock Text="{Binding ProgramGuideText}" FontSize="18" FontWeight="SemiBold" />
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="{Binding StartProgram}" />
<ProgressBar Width="260" Maximum="100" Value="{Binding DurationValue}" />
<TextBlock Text="{Binding EndProgram}" />
</StackPanel> </StackPanel>
</Button>
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Width="70" Height="50" Margin="8,0,0,0" Content="G" Command="{Binding ShowProgramListCommand}" />
<Button Width="70" Height="50" Margin="8,0,0,0" Content="Open" Command="{Binding OpenStreamCommand}" />
</StackPanel> </StackPanel>
<Button Grid.Column="2" Content="Guide" Command="{Binding ShowProgramListCommand}" Margin="0,0,12,0" />
<Button Grid.Column="3" Content="Fullscreen" Command="{Binding FullscreenCommand}" Margin="0,0,12,0" />
<Button Grid.Column="4" Content="Open" Command="{Binding OpenStreamCommand}" Margin="0,0,12,0" />
<Button Grid.Column="5" Content="Close" Command="{Binding CloseAppCommand}" />
</Grid> </Grid>
</Grid>
<Border Background="#66000000"
Padding="10"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="10"
IsVisible="{Binding HasPlaybackStatus}">
<TextBlock Text="{Binding PlaybackStatus}" Foreground="White" TextWrapping="Wrap" MaxWidth="420" />
</Border> </Border>
</Grid> </Grid>
</UserControl> </UserControl>
@@ -2,32 +2,38 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="TV_Player.AvaloniaApp.Views.PlaylistsGroupView" x:Class="TV_Player.AvaloniaApp.Views.PlaylistsGroupView"
x:Name="Root"> x:Name="Root">
<ScrollViewer> <Grid VerticalAlignment="Center">
<ItemsControl ItemsSource="{Binding Programs}"> <ListBox ItemsSource="{Binding Programs}"
<ItemsControl.ItemsPanel> Background="Transparent"
BorderThickness="0"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">
<ListBox.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" /> <UniformGrid Columns="4" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ListBox.ItemsPanel>
<ItemsControl.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Button Width="260" <Button Width="170"
Height="120" Height="130"
Margin="10" Margin="8"
Padding="18" Background="#B0000000"
CornerRadius="16" BorderBrush="Yellow"
Background="#AA111827"
BorderBrush="#EAB308"
BorderThickness="2" BorderThickness="2"
Command="{Binding DataContext.SelectPlaylistCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" Command="{Binding DataContext.SelectPlaylistCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}"> CommandParameter="{Binding}">
<StackPanel Spacing="8"> <TextBlock Text="{Binding Name}"
<TextBlock Text="{Binding Name}" FontSize="24" FontWeight="Bold" TextWrapping="Wrap" /> Foreground="White"
<TextBlock Text="Open playlist" Foreground="#D1D5DB" /> FontSize="20"
</StackPanel> FontWeight="Bold"
TextWrapping="Wrap"
HorizontalAlignment="Center"
VerticalAlignment="Center"
TextAlignment="Center" />
</Button> </Button>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ListBox.ItemTemplate>
</ItemsControl> </ListBox>
</ScrollViewer> </Grid>
</UserControl> </UserControl>
@@ -1,43 +1,43 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="TV_Player.AvaloniaApp.Views.ProgramsGroupView"> x:Class="TV_Player.AvaloniaApp.Views.ProgramsGroupView">
<Grid RowDefinitions="Auto,*"> <Grid VerticalAlignment="Center">
<!-- Debug Info Header --> <ListBox ItemsSource="{Binding Programs}"
<Border Grid.Row="0" Background="#1a1a2e" Padding="16" Margin="0,0,0,4"> Background="Transparent"
<TextBlock Text="{Binding Programs.Count, StringFormat='Groups Loaded: {0}'}" BorderThickness="0"
Foreground="#EAB308" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
FontSize="14" ScrollViewer.VerticalScrollBarVisibility="Auto">
FontWeight="Bold" /> <ListBox.ItemsPanel>
</Border> <ItemsPanelTemplate>
<UniformGrid Columns="4" />
<!-- Groups List --> </ItemsPanelTemplate>
<ScrollViewer Grid.Row="1"> </ListBox.ItemsPanel>
<ItemsControl ItemsSource="{Binding Programs}"> <ListBox.ItemTemplate>
<ItemsControl.ItemsPanel> <DataTemplate>
<ItemsPanelTemplate> <Button Width="170"
<WrapPanel Orientation="Horizontal" /> Height="130"
</ItemsPanelTemplate> Margin="8"
</ItemsControl.ItemsPanel> Background="#B0000000"
<ItemsControl.ItemTemplate> BorderBrush="Yellow"
<DataTemplate> BorderThickness="2"
<Button Width="260" Command="{Binding DataContext.SelectGroupCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
Height="140" CommandParameter="{Binding}">
Margin="10" <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Spacing="6">
Padding="18" <TextBlock Text="{Binding Name}"
CornerRadius="16" Foreground="White"
Background="#AA111827" FontSize="20"
BorderBrush="#EAB308" FontWeight="Bold"
BorderThickness="2" TextWrapping="Wrap"
Command="{Binding DataContext.SelectGroupCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" HorizontalAlignment="Center"
CommandParameter="{Binding}"> TextAlignment="Center" />
<StackPanel Spacing="8"> <TextBlock Text="{Binding Count}"
<TextBlock Text="{Binding Name}" FontSize="24" FontWeight="Bold" TextWrapping="Wrap" /> Foreground="White"
<TextBlock Text="{Binding Count, StringFormat='Channels: {0}'}" Foreground="#D1D5DB" /> FontSize="16"
</StackPanel> HorizontalAlignment="Center" />
</Button> </StackPanel>
</DataTemplate> </Button>
</ItemsControl.ItemTemplate> </DataTemplate>
</ItemsControl> </ListBox.ItemTemplate>
</ScrollViewer> </ListBox>
</Grid> </Grid>
</UserControl> </UserControl>
+31 -22
View File
@@ -1,34 +1,43 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="TV_Player.AvaloniaApp.Views.ProgramsListView"> x:Class="TV_Player.AvaloniaApp.Views.ProgramsListView">
<ScrollViewer> <Grid>
<ItemsControl ItemsSource="{Binding Programs}"> <ListBox ItemsSource="{Binding Programs}"
<ItemsControl.ItemsPanel> Background="Transparent"
VerticalAlignment="Top"
Margin="0,50,0,0"
BorderThickness="0"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto">
<ListBox.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" /> <UniformGrid Columns="12" />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ListBox.ItemsPanel>
<ItemsControl.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Button Width="160" <Button Width="106"
Height="170" Height="145"
Margin="8" Margin="3"
Padding="10" Background="#B0000000"
CornerRadius="14" BorderBrush="Yellow"
Background="#AA111827"
BorderBrush="#EAB308"
BorderThickness="2" BorderThickness="2"
Command="{Binding DataContext.SelectProgramCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" Command="{Binding DataContext.SelectProgramCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding}"> CommandParameter="{Binding}">
<StackPanel Spacing="10"> <Grid Margin="1" Background="#B0000000" RowDefinitions="*,Auto">
<Border Height="90" Background="#1F2937" CornerRadius="10"> <Image Source="{Binding Logo}" MaxWidth="100" Margin="0,0,0,10" Stretch="Uniform" />
<Image Source="{Binding Logo}" Stretch="Uniform" /> <TextBlock Grid.Row="1"
</Border> Text="{Binding Name}"
<TextBlock Text="{Binding Name}" TextWrapping="Wrap" TextAlignment="Center" /> FontSize="15"
</StackPanel> Foreground="White"
TextWrapping="Wrap"
TextAlignment="Center"
Margin="1,0,1,2"
HorizontalAlignment="Center" />
</Grid>
</Button> </Button>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ListBox.ItemTemplate>
</ItemsControl> </ListBox>
</ScrollViewer> </Grid>
</UserControl> </UserControl>
+37 -33
View File
@@ -1,47 +1,51 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="TV_Player.AvaloniaApp.Views.SettingsView"> x:Class="TV_Player.AvaloniaApp.Views.SettingsView">
<ScrollViewer> <Viewbox>
<StackPanel Width="900" HorizontalAlignment="Center" Spacing="18"> <StackPanel VerticalAlignment="Center" Width="900">
<TextBlock Text="Settings" FontSize="30" FontWeight="Bold" HorizontalAlignment="Center" /> <TextBlock Margin="10"
Foreground="White"
HorizontalAlignment="Center"
FontSize="25"
FontWeight="Bold"
Text="Settings" />
<Border Background="#AA111827" Padding="18" CornerRadius="16"> <StackPanel Margin="10" Spacing="8">
<StackPanel Spacing="12"> <TextBlock Foreground="White" FontSize="22" FontWeight="Bold" Text="Playlist URL" />
<TextBlock Text="Playlist URL" /> <TextBox Text="{Binding PlaylistURL}" />
<TextBox Text="{Binding PlaylistURL}" Watermark="https://example.com/playlist.m3u" /> <TextBlock Foreground="White" FontSize="22" FontWeight="Bold" Text="Playlist Name" />
<TextBlock Text="Playlist name" /> <TextBox Text="{Binding PlaylistName}" />
<TextBox Text="{Binding PlaylistName}" Watermark="My IPTV" /> <Button Content="Add" Width="70" Height="70" HorizontalAlignment="Center" Command="{Binding AddPlaylistCommand}" />
<Button Content="Add playlist" Command="{Binding AddPlaylistCommand}" HorizontalAlignment="Left" /> </StackPanel>
</StackPanel>
</Border>
<Border Background="#AA111827" Padding="18" CornerRadius="16"> <ListBox Height="250"
<StackPanel Spacing="12"> ItemsSource="{Binding Playlists}"
<TextBlock Text="Playlists" FontSize="22" FontWeight="SemiBold" /> Background="Transparent"
<ItemsControl ItemsSource="{Binding Playlists}"> BorderThickness="0"
<ItemsControl.ItemTemplate> ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid ColumnDefinitions="220,*,Auto" Margin="0,4"> <Grid HorizontalAlignment="Stretch" Height="80" ColumnDefinitions="200,*,100">
<TextBlock Text="{Binding Key}" VerticalAlignment="Center" Margin="0,0,12,0" /> <TextBlock Foreground="White" VerticalAlignment="Center" FontSize="25" FontWeight="Bold" Text="{Binding Key}" />
<TextBlock Grid.Column="1" Text="{Binding Value}" VerticalAlignment="Center" TextWrapping="Wrap" Margin="0,0,12,0" /> <TextBlock Grid.Column="1" Foreground="White" VerticalAlignment="Center" FontSize="25" FontWeight="Bold" Text="{Binding Value}" />
<Button Grid.Column="2" <Button Grid.Column="2"
Content="Remove" Width="70"
Command="{Binding DataContext.PlaylistDeleteCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" Height="70"
CommandParameter="{Binding}" /> Content="-"
CommandParameter="{Binding}"
Command="{Binding DataContext.PlaylistDeleteCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" />
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ListBox.ItemTemplate>
</ItemsControl> </ListBox>
</StackPanel>
</Border>
<CheckBox IsChecked="{Binding StartFullScreen}" Content="Start in fullscreen" /> <CheckBox Margin="10" Foreground="White" FontSize="25" IsChecked="{Binding StartFullScreen}" Content="Fullscreen" />
<CheckBox IsChecked="{Binding StartLastScreen}" Content="Remember last screen" /> <CheckBox Margin="10" Foreground="White" FontSize="25" IsChecked="{Binding StartLastScreen}" Content="Remember last" />
<StackPanel Orientation="Horizontal" Spacing="12" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Back" Command="{Binding BackCommand}" MinWidth="120" /> <Button Width="70" Height="70" Margin="10,0,50,0" Content="B" Command="{Binding BackCommand}" />
<Button Content="Save" Command="{Binding SaveCommand}" MinWidth="120" /> <Button Width="70" Height="70" Content="OK" Command="{Binding SaveCommand}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</ScrollViewer> </Viewbox>
</UserControl> </UserControl>
+8 -10
View File
@@ -221,16 +221,14 @@ namespace TV_Player
{ {
try try
{ {
using (var client = new HttpClient()) using var client = new HttpClient();
using (var request = new HttpRequestMessage()) using var request = new HttpRequestMessage();
{ client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/text"));
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/text")); request.Method = HttpMethod.Get;
request.Method = HttpMethod.Get; request.RequestUri = new Uri(url);
request.RequestUri = new Uri(url); var response = await client.GetAsync(url);
var response = await client.GetAsync(url); response.EnsureSuccessStatusCode();
response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync();
return await response.Content.ReadAsStringAsync();
}
} }
catch (HttpRequestException ex) catch (HttpRequestException ex)
{ {