diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/DoubleToHMSConverter.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Converters.cs similarity index 77% rename from QuickLook.Plugin/QuickLook.Plugin.VideoViewer/DoubleToHMSConverter.cs rename to QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Converters.cs index e04bb61..fb29639 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/DoubleToHMSConverter.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Converters.cs @@ -57,4 +57,22 @@ namespace QuickLook.Plugin.VideoViewer throw new NotImplementedException(); } } + + public sealed class BooleanToVisibilityHiddenConverter : DependencyObject, IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + return Visibility.Hidden; + + var v = (bool) value; + + return v ? Visibility.Hidden : Visibility.Visible; + } + + object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } } \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/HorizontalSliderStyle.xaml b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/HorizontalSliderStyle.xaml deleted file mode 100644 index 2f3152a..0000000 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/HorizontalSliderStyle.xaml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Plugin.cs index 9e330a9..ee8319e 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Plugin.cs @@ -57,8 +57,6 @@ namespace QuickLook.Plugin.VideoViewer using (var element = new MediaElement {Source = new Uri(path)}) { context.SetPreferredSizeFit(new Size(element.NaturalVideoWidth, element.NaturalVideoHeight), 0.6); - context.PreferredSize = new Size(context.PreferredSize.Width, - context.PreferredSize.Height + 26); // add control bar } } diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj index f390cf3..cd9715b 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj @@ -70,7 +70,7 @@ - + MSBuild:Compile Designer @@ -81,7 +81,7 @@ Properties\GitVersion.cs - + ViewerPanel.xaml diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Styles.xaml b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Styles.xaml new file mode 100644 index 0000000..10abae4 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/Styles.xaml @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml index 5daa834..5b1e0ba 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml @@ -7,50 +7,122 @@ xmlns:local="clr-namespace:QuickLook.Plugin.VideoViewer" xmlns:ffmpeg="clr-namespace:Unosquare.FFmpegMediaElement;assembly=Unosquare.FFmpegMediaElement" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> + d:DesignHeight="449.167" d:DesignWidth="767"> + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - - - - - - - + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs index 633fa36..1e6cd0c 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs @@ -16,12 +16,9 @@ // along with this program. If not, see . using System; -using System.ComponentModel; using System.Diagnostics; -using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using FontAwesome.WPF; using Unosquare.FFmpegMediaElement; namespace QuickLook.Plugin.VideoViewer @@ -40,14 +37,14 @@ namespace QuickLook.Plugin.VideoViewer _context = context; buttonPlayPause.MouseLeftButtonUp += TogglePlayPause; - buttonMute.MouseLeftButtonUp += (sender, e) => - { - mediaElement.IsMuted = false; - buttonMute.Visibility = Visibility.Collapsed; - }; + //buttonMute.MouseLeftButtonUp += (sender, e) => + //{ + // mediaElement.IsMuted = false; + // buttonMute.Visibility = Visibility.Collapsed; + //}; + buttonMute.MouseLeftButtonUp += (sender, e) => mediaElement.IsMuted = !mediaElement.IsMuted; + buttonStop.MouseLeftButtonUp += (sender, e) => mediaElement.Stop(); - mediaElement.PropertyChanged += ChangePlayPauseButton; - mediaElement.MouseLeftButtonUp += TogglePlayPause; mediaElement.MediaErrored += ShowErrorNotification; mediaElement.MediaFailed += ShowErrorNotification; } @@ -55,6 +52,7 @@ namespace QuickLook.Plugin.VideoViewer public void Dispose() { mediaElement?.Dispose(); + mediaElement = null; } private void TogglePlayPause(object sender, MouseButtonEventArgs e) @@ -65,16 +63,6 @@ namespace QuickLook.Plugin.VideoViewer mediaElement.Play(); } - private void ChangePlayPauseButton(object sender, PropertyChangedEventArgs e) - { - if (e.PropertyName != "IsPlaying" && e.PropertyName != "HasMediaEnded") - return; - - buttonPlayPause.Icon = mediaElement.IsPlaying - ? FontAwesomeIcon.PauseCircleOutline - : FontAwesomeIcon.PlayCircleOutline; - } - [DebuggerNonUserCode] private void ShowErrorNotification(object sender, MediaErrorRoutedEventArgs e) {