wip videoviewer

This commit is contained in:
Paddy Xu
2017-08-08 23:19:46 +03:00
parent 2b3338cc43
commit efaca311fc
10 changed files with 127 additions and 75 deletions

View File

@@ -10,6 +10,7 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/ScrollBarStyleDictionary.xaml" />
<ResourceDictionary Source="Styles/BusyDecorator.xaml" />
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@@ -19,9 +19,6 @@
ShowActivated="False" ShowInTaskbar="False">
<controls:MainWindowBase.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/MainWindowStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<converters:BooleanToResizeModeConverter x:Key="BooleanToResizeModeConverter" />
<converters:BooleanToKeyTimeConverter x:Key="BooleanToKeyTimeConverter" />
<converters:WindowStateToThicknessConverter x:Key="WindowStateToThicknessConverter" />
@@ -33,7 +30,7 @@
</controls:MainWindowBase.Resources>
<controls:MainWindowBase.Style>
<Style TargetType="controls:MainWindowBase">
<Setter Property="Foreground" Value="{DynamicResource MainWindowForeground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowTextForeground}" />
<Setter Property="ResizeMode"
Value="{Binding ContextObject.CanResize, ElementName=mainWindow, Converter={StaticResource BooleanToResizeModeConverter}}" />
<Setter Property="WindowChrome.WindowChrome">
@@ -61,29 +58,29 @@
</Border.Effect>
<Grid x:Name="windowFrameContainer" Background="{DynamicResource MainWindowBackground}"
Margin="{Binding WindowState, ElementName=mainWindow, Converter={StaticResource WindowStateToThicknessConverter}, ConverterParameter={StaticResource MainWindowShadowPaddingThinkness}}">
<Grid.Resources>
<Storyboard x:Key="ShowCaptionStoryboard">
<DoubleAnimation
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05">
</DoubleAnimation>
</Storyboard>
<Storyboard x:Key="ShowAndHideTitlebarStoryboard">
<DoubleAnimationUsingKeyFrames
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
Storyboard.TargetProperty="Opacity">
<DoubleAnimationUsingKeyFrames.KeyFrames>
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:0.05" />
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:3" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:3.05" />
</DoubleAnimationUsingKeyFrames.KeyFrames>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Grid x:Name="viewerRootContainer" ZIndex="190">
<Grid x:Name="windowCaptionContainer" Height="{StaticResource MainWindowCaptionHeight}"
VerticalAlignment="Top"
ZIndex="100">
<Grid.Resources>
<Storyboard x:Key="ShowCaptionContainerStoryboard" Completed="AutoHideCaptionContainer">
<DoubleAnimation
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.05">
</DoubleAnimation>
</Storyboard>
<Storyboard x:Key="HideCaptionContainerStoryboard">
<DoubleAnimationUsingKeyFrames
Storyboard.Target="{Binding Source={x:Reference windowCaptionContainer}}"
Storyboard.TargetProperty="Opacity">
<DoubleAnimationUsingKeyFrames.KeyFrames>
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:0" />
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:3" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:3.05" />
</DoubleAnimationUsingKeyFrames.KeyFrames>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<glassLayer:GlassLayer OverlayColor="{DynamicResource CaptionBackground}" BlurredElement="{Binding ElementName=containerPanel}" />
<DockPanel>
<Button x:Name="buttonCloseWindow" Style="{StaticResource CaptionCloseButtonStyle}"

View File

@@ -103,22 +103,26 @@ namespace QuickLook
private void ShowWindowCaptionContainer(object sender, MouseEventArgs e)
{
var show = (Storyboard) windowFrameContainer.FindResource("ShowCaptionStoryboard");
var showAndHide = (Storyboard) windowFrameContainer.FindResource("ShowAndHideTitlebarStoryboard");
var show = (Storyboard) windowCaptionContainer.FindResource("ShowCaptionContainerStoryboard");
if (!ContextObject.TitlebarOverlap)
{
if (windowCaptionContainer.Opacity == 0 || windowCaptionContainer.Opacity == 1)
show.Begin();
showAndHide.Stop();
}
private void AutoHideCaptionContainer(object sender, EventArgs e)
{
if (!ContextObject.TitlebarOverlap)
return;
}
if (windowCaptionContainer.IsMouseOver)
show.Begin();
else
showAndHide.Begin();
return;
var hide = (Storyboard) windowCaptionContainer.FindResource("HideCaptionContainerStoryboard");
hide.Begin();
}
public bool Pinned
{
get => _pinned;
@@ -401,16 +405,6 @@ namespace QuickLook
ProcessHelper.PerformAggressiveGC();
}
public void ShowTitlebar()
{
}
public void HideTitlebar()
{
var sb = FindResource("HideTitlebarStoryboard") as Storyboard;
sb?.Begin();
}
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
@@ -421,13 +415,13 @@ namespace QuickLook
{
if (dark)
{
if (!Resources.MergedDictionaries.Contains(_darkDict))
Resources.MergedDictionaries.Add(_darkDict);
if (!Application.Current.Resources.MergedDictionaries.Contains(_darkDict))
Application.Current.Resources.MergedDictionaries.Add(_darkDict);
}
else
{
if (Resources.MergedDictionaries.Contains(_darkDict))
Resources.MergedDictionaries.Remove(_darkDict);
if (Application.Current.Resources.MergedDictionaries.Contains(_darkDict))
Application.Current.Resources.MergedDictionaries.Remove(_darkDict);
}
}
}

View File

@@ -54,11 +54,11 @@
FilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilenameFilename.ext
</TextBlock>
<TextBlock x:Name="modDate" Grid.Row="3" Grid.Column="1" Padding="3" FontWeight="Light"
Foreground="DimGray">
Foreground="{DynamicResource WindowTextForegroundAlternative}">
Last modified at 01/01/2017 00:00:00
</TextBlock>
<TextBlock x:Name="totalSize" Grid.Row="4" Grid.Column="1" Padding="3" FontWeight="Light"
Foreground="DimGray">
Foreground="{DynamicResource WindowTextForegroundAlternative}">
Calculating size...
</TextBlock>
</Grid>

View File

@@ -4,7 +4,8 @@
xmlns:fa="http://schemas.fontawesome.io/icons/">
<Color x:Key="MainWindowShadowColor">Gray</Color>
<SolidColorBrush x:Key="MainWindowBackground" Color="#FF565656" />
<SolidColorBrush x:Key="MainWindowForeground" Color="#E5EFEFEF" />
<SolidColorBrush x:Key="WindowTextForeground" Color="#E5EFEFEF" />
<SolidColorBrush x:Key="WindowTextForegroundAlternative" Color="#E5EFEFEF" />
<SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FFB9B9B9" />
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5EFEFEF" />
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#22FFFFFF" />

View File

@@ -7,7 +7,8 @@
<system:Double x:Key="MainWindowCaptionHeight">32</system:Double>
<Color x:Key="MainWindowShadowColor">Gray</Color>
<SolidColorBrush x:Key="MainWindowBackground" Color="#FFF8F8FB" />
<SolidColorBrush x:Key="MainWindowForeground" Color="#E50E0E0E" />
<SolidColorBrush x:Key="WindowTextForeground" Color="#E50E0E0E" />
<SolidColorBrush x:Key="WindowTextForegroundAlternative" Color="#E5626262" />
<SolidColorBrush x:Key="CaptionTextHoverBorder" Color="#FF3D3D3D" />
<SolidColorBrush x:Key="CaptionButtonIconForeground" Color="#E5868686" />
<SolidColorBrush x:Key="CaptionButtonHoverBackground" Color="#44FFFFFF" />
@@ -19,7 +20,7 @@
<Style x:Key="CaptionButtonBaseStyle" TargetType="Button">
<Setter Property="Focusable" Value="False" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="{DynamicResource MainWindowForeground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowTextForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />