-
Notifications
You must be signed in to change notification settings - Fork 4
/
MainWindow.xaml
159 lines (148 loc) · 9.83 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<local:BorderlessWindow x:Name="MainWin" x:Class="ZipImageViewer.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ZipImageViewer"
xmlns:fa="http://schemas.fontawesome.com/icons/"
xmlns:vir="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"
Icon="Resources/ZipImageViewer.ico"
mc:Ignorable="d" UseLayoutRounding="True" Background="{StaticResource BackgroundDarkBrush}" Foreground="{StaticResource ForegroundBrush}"
Title="{Binding ElementName=MainWin, Path=CurrentPath, Mode=OneWay}" Height="730" Width="1140" Drop="MainWin_Drop" AllowDrop="True"
Loaded="MainWin_Loaded" Closing="MainWin_Closing" Closed="MainWin_Closed" DpiChanged="MainWin_DpiChanged" KeyDown="MainWin_KeyDown">
<Window.Resources>
<local:FlagToImageConverter x:Key="FlagToImageConverter"/>
<CollectionViewSource x:Key="ObjectListViewSource"
Source="{Binding ElementName=MainWin, Path=ObjectList, Mode=OneTime}">
</CollectionViewSource>
<local:CustomCmdArgsConverter x:Key="CustomCmdArgsConverter"/>
<DataTemplate x:Key="ThumbDataTemplate" DataType="{x:Type local:ObjectInfo}">
<StackPanel x:Name="SP1" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" UseLayoutRounding="True">
<local:Thumbnail x:Name="TN1" RenderTransformOrigin="0.5 0.5" Panel.ZIndex="1" PreviewMouseUp="TN1_Click"
ObjectInfo="{Binding Mode=OneTime}" Margin="10"
Width="{Binding ElementName=MainWin, Path=ThumbRealWidth, Mode=OneWay}"
Height="{Binding ElementName=MainWin, Path=ThumbRealHeight, Mode=OneWay}">
<local:Thumbnail.Style>
<Style TargetType="local:Thumbnail" BasedOn="{StaticResource S_RiseOnHover}"/>
</local:Thumbnail.Style>
</local:Thumbnail>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Panel.ZIndex="0">
<StackPanel.Style>
<Style TargetType="StackPanel">
<Style.Triggers>
<DataTrigger Binding="{Binding ImmersionMode, Source={x:Static local:App.Setting}, Mode=OneWay}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
<fa:FontAwesome FontSize="12" Margin="0 0 4 0"
Icon="{Binding Flags, Converter={StaticResource FlagToImageConverter}, Mode=OneWay}"/>
<TextBlock Text="{Binding DisplayName, Mode=OneTime}" FontSize="10"
MaxWidth="{Binding ElementName=MainWin, Path=ThumbRealWidth, Mode=OneWay}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</Window.Resources>
<Grid>
<Border x:Name="B_SidePanel" HorizontalAlignment="Left" VerticalAlignment="Center"
Panel.ZIndex="99" Padding="0 20 20 20" Background="Transparent">
<Border.Style>
<Style TargetType="Border">
<Setter Property="RenderTransform">
<Setter.Value>
<TranslateTransform X="-90"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.X" Duration="0:0:0.3" To="-20" EasingFunction="{StaticResource CE_EaseOut}"/>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" To="1" EasingFunction="{StaticResource CE_EaseOut}"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.X" Duration="0:0:0.3" To="-90" EasingFunction="{StaticResource CE_EaseOut}"/>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" To="0.2" EasingFunction="{StaticResource CE_EaseOut}"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<Border Background="{StaticResource BackgroundLightBrush}" CornerRadius="0 10 10 0" Width="100">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="10"/>
</Border.Effect>
<Border.Resources>
<Style TargetType="fa:FontAwesome" BasedOn="{StaticResource S_DropShadow}">
<EventSetter Event="MouseUp" Handler="Sidebar_Click"/>
<Setter Property="Width" Value="48"/>
<Setter Property="FontSize" Value="42"/>
<Setter Property="Foreground" Value="{StaticResource ForegroundBrush}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="RenderTransformOrigin" Value="0.5 0.5"/>
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform/>
</TransformGroup>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource SB_Rise_Up_L}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource SB_Rise_Down_L}"/>
</Trigger.ExitActions>
</Trigger>
<DataTrigger Binding="{Binding Opacity, ElementName=B_SidePanel, Mode=OneWay}" Value="0.2">
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources>
<local:PaddedGrid Margin="10" HorizontalAlignment="Right" Padding="8">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<fa:FontAwesome Grid.Row="0" Name="HY_Open" ToolTip="{StaticResource ttl_OpenFolder}" Icon="Solid_FolderOpen"/>
<fa:FontAwesome Grid.Row="1" Name="HY_CacheFirst" ToolTip="{StaticResource spn_CacheFirstTip}" Icon="Solid_AngleDown"/>
<fa:FontAwesome Grid.Row="2" Name="HY_CacheAll" ToolTip="{StaticResource spn_CacheAllTip}" Icon="Solid_AngleDoubleDown"/>
<fa:FontAwesome Grid.Row="3" Name="HY_Options" ToolTip="{StaticResource ttl_Options}" Icon="Solid_Cog"/>
<fa:FontAwesome Grid.Row="4" Name="HY_Slideshow" ToolTip="{StaticResource ttl_StartSlideshow}" Icon="Solid_Film"/>
<fa:FontAwesome Grid.Row="5" Name="HY_ImmersionMode" ToolTip="{StaticResource ttl_ImmsersionMode}" Icon="Solid_Headphones"/>
<fa:FontAwesome Grid.Row="6" Name="HY_Close" ToolTip="{StaticResource ttl_CloseWindow}" Icon="Solid_TimesCircle"/>
</local:PaddedGrid>
</Border>
</Border>
<vir:VirtualizingItemsControl x:Name="TV1" MouseUp="TV1_Click" MouseDoubleClick="TV1_DoubleClick"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.PanningMode="VerticalOnly"
ItemsSource="{Binding Source={StaticResource ObjectListViewSource}, Mode=OneTime}"
ItemTemplate="{StaticResource ThumbDataTemplate}">
<vir:VirtualizingItemsControl.Resources>
<Style TargetType="ScrollBar" BasedOn="{StaticResource AppleStyleScrollBar}"/>
</vir:VirtualizingItemsControl.Resources>
<vir:VirtualizingItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<local:VirtualizingWrapPanel MouseWheelDeltaItem="1"/>
</ItemsPanelTemplate>
</vir:VirtualizingItemsControl.ItemsPanel>
</vir:VirtualizingItemsControl>
</Grid>
</local:BorderlessWindow>