finish auto-hide

This commit is contained in:
Paddy Xu
2017-08-06 21:01:02 +03:00
parent 5b97e7ef60
commit 56cb31fd2a
16 changed files with 241 additions and 71 deletions

View File

@@ -9,7 +9,7 @@
x:Name="imagePanel"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Rectangle>
<Rectangle Visibility="{Binding BackgroundVisibility, ElementName=imagePanel}">
<Rectangle.Fill>
<ImageBrush x:Name="backgroundBrush" ImageSource="Resources/background.png" AlignmentY="Top" Viewport="0,0,32,32"
ViewportUnits="Absolute" Stretch="UniformToFill" TileMode="Tile" />

View File

@@ -45,6 +45,7 @@ namespace QuickLook.Plugin.ImageViewer
private BitmapScalingMode _renderMode = BitmapScalingMode.HighQuality;
private BitmapSource _source;
private double _zoomFactor = 1d;
private Visibility _backgroundVisibility = Visibility.Visible;
private bool _zoomToFit = true;
@@ -88,6 +89,16 @@ namespace QuickLook.Plugin.ImageViewer
}
}
public Visibility BackgroundVisibility
{
get => _backgroundVisibility;
set
{
_backgroundVisibility = value;
OnPropertyChanged();
}
}
public double MinZoomFactor
{
get => _minZoomFactor;

View File

@@ -64,8 +64,7 @@ namespace QuickLook.Plugin.ImageViewer
context.PreferredSize = new Size(1024, 768);
Directory.SetCurrentDirectory(App.AppPath);
context.AutoHideTitlebar = true;
context.TitlebarOverlap = true;
}

View File

@@ -70,7 +70,7 @@
</ListBox.ItemTemplate>
</ListBox>
<Grid Grid.Column="1" Background="#00EFEFEF">
<imageViewer:ImagePanel x:Name="pagePanel" RenderMode="NearestNeighbor" />
<imageViewer:ImagePanel x:Name="pagePanel" RenderMode="NearestNeighbor" BackgroundVisibility="Collapsed" />
</Grid>
</Grid>
</UserControl>

View File

@@ -64,7 +64,7 @@ namespace QuickLook.Plugin.TextViewer
public void View(string path, ContextObject context)
{
_tvp = new TextViewerPanel(path);
_tvp = new TextViewerPanel(path, context);
context.ViewerContent = _tvp;
context.Title = $"{Path.GetFileName(path)}";

View File

@@ -21,7 +21,6 @@ using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Highlighting;
using QuickLook.Helpers;
using UtfUnknown;
namespace QuickLook.Plugin.TextViewer
@@ -31,7 +30,7 @@ namespace QuickLook.Plugin.TextViewer
/// </summary>
public partial class TextViewerPanel : UserControl
{
public TextViewerPanel(string path)
public TextViewerPanel(string path, ContextObject context)
{
InitializeComponent();
@@ -42,7 +41,7 @@ namespace QuickLook.Plugin.TextViewer
viewer.PreviewMouseWheel += Viewer_MouseWheel;
viewer.FontFamily =
new FontFamily(TranslationHelper.GetString("Editor_FontFamily"));
new FontFamily(context.GetString("Editor_FontFamily"));
LoadFile(path);
}

View File

@@ -266,7 +266,7 @@ namespace QuickLook.Plugin.VideoViewer
[DebuggerNonUserCode]
private void ShowErrorNotification(object sender, EventArgs e)
{
TrayIconManager.GetInstance().ShowNotification("", "An error occurred while loading the video.");
_context.ShowNotification("", "An error occurred while loading the video.");
mediaElement?.Stop();
Dispose();