From 4e843637cbef858250e3d3619389603c73ed1a09 Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Sun, 25 Feb 2018 00:26:22 +0200 Subject: [PATCH] hide viewer while loading --- .../BooleanToVisibilityHiddenConverter.cs | 42 +++++++++++++++++++ QuickLook/QuickLook.csproj | 1 + QuickLook/ViewerWindow.xaml | 2 + 3 files changed, 45 insertions(+) create mode 100644 QuickLook/Converters/BooleanToVisibilityHiddenConverter.cs diff --git a/QuickLook/Converters/BooleanToVisibilityHiddenConverter.cs b/QuickLook/Converters/BooleanToVisibilityHiddenConverter.cs new file mode 100644 index 0000000..021afa3 --- /dev/null +++ b/QuickLook/Converters/BooleanToVisibilityHiddenConverter.cs @@ -0,0 +1,42 @@ +// Copyright © 2017 Paddy Xu +// +// This file is part of QuickLook program. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace QuickLook.Converters +{ + 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/QuickLook.csproj b/QuickLook/QuickLook.csproj index 818d9e7..c06fc15 100644 --- a/QuickLook/QuickLook.csproj +++ b/QuickLook/QuickLook.csproj @@ -118,6 +118,7 @@ GlassLayer.xaml + diff --git a/QuickLook/ViewerWindow.xaml b/QuickLook/ViewerWindow.xaml index 1b0ce87..c2bc045 100644 --- a/QuickLook/ViewerWindow.xaml +++ b/QuickLook/ViewerWindow.xaml @@ -23,6 +23,7 @@ + @@ -150,6 +151,7 @@