Support local file paths for M3U playlists; UI tweaks

Added support for loading M3U playlists from both web URLs and local file paths, with logic to resolve relative paths. Improved exception handling in M3UParser. Enabled toggling of window border style in fullscreen mode, with data binding for WindowStyle. Removed IsValidUrl check to allow local file sources in settings. Cleaned up usings and formatting. Removed .NET SDK version from global.json.
This commit is contained in:
2026-04-10 12:48:12 +03:00
parent a42ada7f96
commit 24ca481b64
7 changed files with 57 additions and 18 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TV_Player"
mc:Ignorable="d" WindowStyle="None" WindowState="{Binding CurrentWindowState}"
mc:Ignorable="d" WindowStyle="{Binding CurrentWindowStyle}" WindowState="{Binding CurrentWindowState}"
Title="TV" Height="450" Width="800"
KeyDown="UserControl_KeyDown">
<Window.Resources>
+12
View File
@@ -36,6 +36,14 @@ namespace TV_Player
get => _currentWindowState;
set => SetProperty(ref _currentWindowState, value);
}
private WindowStyle _currentWindowStyle;
public WindowStyle CurrentWindowStyle
{
get => _currentWindowStyle;
set => SetProperty(ref _currentWindowStyle, value);
}
public ICommand OnKeyDownCommand { get; }
public ICommand FullscreenCommand { get; }
@@ -53,6 +61,7 @@ namespace TV_Player
FullscreenCommand = new RelayCommand(OnFullSctreenButtonClick);
SettingsCommand = new RelayCommand(OnSettingsButtonClick);
CloseAppCommand = new RelayCommand(OnCloseAppButtonClick);
CurrentWindowStyle = WindowStyle.SingleBorderWindow;
}
public void OnFullSctreenButtonClick()
@@ -60,10 +69,13 @@ namespace TV_Player
if (CurrentWindowState == WindowState.Normal)
{
CurrentWindowState = WindowState.Maximized;
CurrentWindowStyle = WindowStyle.None;
}
else
{
CurrentWindowState = WindowState.Normal;
CurrentWindowStyle = WindowStyle.SingleBorderWindow;
}
}
@@ -21,7 +21,8 @@ namespace TV_Player
public ProgramsGroupViewModel()
{
ItemSelectedCommand = new RelayCommand(OnItemSelected);
_groupInformationSubscriber = TVPlayerViewModel.Instance.CurrentProgrmsData.GroupsInformation.Subscribe(x => Programs = SettingsModel.HiddenGroups == null ? x : x.Where(g => !SettingsModel.HiddenGroups.Contains(g.Name.ToLower())).ToList());
_groupInformationSubscriber = TVPlayerViewModel.Instance.CurrentProgrmsData.GroupsInformation.Subscribe(x =>
Programs = SettingsModel.HiddenGroups == null ? x : x.Where(g => !SettingsModel.HiddenGroups.Contains(g.Name.ToLower())).ToList());
TVPlayerViewModel.Instance.TopPanelVisible(true, "Groups");
@@ -67,16 +67,10 @@ namespace TV_Player.ViewModels
var name = PlaylistName?.Trim();
if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(url))
return;
if (IsValidUrl(url))
Playlists.Add(new KeyValuePair<string, string>(name, url));
Playlists.Add(new KeyValuePair<string, string>(name, url));
}
private bool IsValidUrl(string url)
{
Uri uriResult;
return Uri.TryCreate(url, UriKind.Absolute, out uriResult)
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
}
private void OnPlaylistDeleteCommand(KeyValuePair<string, string> pair)
{