From 61eb987642d99c12a3d1674c7d0ba49c79f0acd5 Mon Sep 17 00:00:00 2001 From: Vova <3emaster@gmail.com> Date: Sun, 21 Jan 2024 07:44:19 +0200 Subject: [PATCH] cleanup unused code --- TV Player WPF/App.xaml.cs | 11 +- TV Player WPF/TV Player WPF.csproj | 5 +- TV Player WPF/VideoPlayer.xaml.cs | 6 +- TV Player WPF/ViewModels/TVPlayerViewModel.cs | 1 - TV Player/PlayerPage.xaml | 7 +- TV Player/PlayerPage.xaml.cs | 109 +++++++++++++++++- 6 files changed, 118 insertions(+), 21 deletions(-) diff --git a/TV Player WPF/App.xaml.cs b/TV Player WPF/App.xaml.cs index 60833f7..36068fa 100644 --- a/TV Player WPF/App.xaml.cs +++ b/TV Player WPF/App.xaml.cs @@ -1,7 +1,4 @@ -using DirectShowLib.BDA; -using System.Configuration; -using System.Data; -using System.Windows; +using System.Windows; using TV_Player.ViewModels; namespace TV_Player @@ -18,5 +15,11 @@ namespace TV_Player base.OnStartup(e); } + + protected override void OnExit(ExitEventArgs e) + { + _tvPlayer = null; + base.OnExit(e); + } } } diff --git a/TV Player WPF/TV Player WPF.csproj b/TV Player WPF/TV Player WPF.csproj index 6391fe6..46b9fae 100644 --- a/TV Player WPF/TV Player WPF.csproj +++ b/TV Player WPF/TV Player WPF.csproj @@ -15,10 +15,11 @@ - + + true + - diff --git a/TV Player WPF/VideoPlayer.xaml.cs b/TV Player WPF/VideoPlayer.xaml.cs index 9b0560b..93a74b9 100644 --- a/TV Player WPF/VideoPlayer.xaml.cs +++ b/TV Player WPF/VideoPlayer.xaml.cs @@ -1,9 +1,7 @@ using LibVLCSharp.Shared; using LibVLCSharp.WPF; -using System.IO; using System.Windows; using System.Windows.Controls; -using System.Windows.Forms.Integration; using System.Windows.Input; namespace TV_Player @@ -13,8 +11,6 @@ namespace TV_Player /// public partial class VideoPlayer : UserControl { - private readonly DirectoryInfo vlcLibDirectory; - public static readonly DependencyProperty SourceUrlProperty = DependencyProperty.Register( "SourceUrl", // Name of the property @@ -114,7 +110,7 @@ namespace TV_Player private void UserControl_Unloaded(object sender, RoutedEventArgs e) { - VideoView.MediaPlayer.Dispose(); + VideoView.MediaPlayer?.Dispose(); } } } diff --git a/TV Player WPF/ViewModels/TVPlayerViewModel.cs b/TV Player WPF/ViewModels/TVPlayerViewModel.cs index 35e8504..c62fa28 100644 --- a/TV Player WPF/ViewModels/TVPlayerViewModel.cs +++ b/TV Player WPF/ViewModels/TVPlayerViewModel.cs @@ -32,6 +32,5 @@ namespace TV_Player.ViewModels control.DataContext = viewModel; _mainViewModel.Control = control; } - } } diff --git a/TV Player/PlayerPage.xaml b/TV Player/PlayerPage.xaml index 0f22423..8b0758c 100644 --- a/TV Player/PlayerPage.xaml +++ b/TV Player/PlayerPage.xaml @@ -5,18 +5,19 @@ xmlns:local="clr-namespace:TV_Player.MAUI" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" Title="PlayerPage" + xmlns:vlc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF" Loaded="ContentPage_Loaded"> - + />--> -