Add application icons

This commit is contained in:
Paddy Xu
2017-05-08 23:23:33 +03:00
parent 8388d7d347
commit b07457b53c
11 changed files with 143 additions and 37 deletions

View File

@@ -41,7 +41,7 @@ namespace QuickLook.Plugin.VideoViewer
public void View(string path, ContextObject context)
{
_vp = new ViewerPanel();
_vp = new ViewerPanel(context);
context.ViewerContent = _vp;

View File

@@ -13,7 +13,9 @@ namespace QuickLook.Plugin.VideoViewer
/// </summary>
public partial class ViewerPanel : UserControl, IDisposable
{
public ViewerPanel()
private ContextObject _context;
public ViewerPanel(ContextObject context)
{
InitializeComponent();
@@ -21,8 +23,8 @@ namespace QuickLook.Plugin.VideoViewer
mediaElement.PropertyChanged += ChangePlayPauseButton;
mediaElement.MouseLeftButtonUp += TogglePlayPause;
mediaElement.MediaErrored += ShowErrorOverlay;
mediaElement.MediaFailed += ShowErrorOverlay;
mediaElement.MediaErrored += ShowErrorNotification;
mediaElement.MediaFailed += ShowErrorNotification;
}
public void Dispose()
@@ -48,10 +50,11 @@ namespace QuickLook.Plugin.VideoViewer
: FontAwesomeIcon.PlayCircleOutline;
}
private void ShowErrorOverlay(object sender, MediaErrorRoutedEventArgs e)
private void ShowErrorNotification(object sender, MediaErrorRoutedEventArgs e)
{
mediaElement.Stop();
errorOverlay.Visibility = Visibility.Visible;
_context.ShowNotification("", "An error occurred while loading the video.");
}
public void LoadAndPlay(string path)