-
Notifications
You must be signed in to change notification settings - Fork 4
/
ViewWindow.xaml
237 lines (210 loc) · 15.6 KB
/
ViewWindow.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<local:BorderlessWindow x:Class="ZipImageViewer.ViewWindow" x:Name="ViewWin"
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:fa="http://schemas.fontawesome.com/icons/"
xmlns:local="clr-namespace:ZipImageViewer" mc:Ignorable="d"
Icon="Resources/ZipImageViewer.ico" Padding="0"
Width="1280" Height="960" Foreground="{StaticResource ForegroundBrush}"
UseLayoutRounding="True" SizeChanged="ViewWin_SizeChanged"
Loaded="ViewWindow_Loaded" Closing="ViewWin_Closing" Closed="ViewWin_Closed" PreviewKeyUp="ViewWin_PreviewKeyUp">
<Window.Title>
<MultiBinding Mode="OneWay" StringFormat="{}{0}\{1}">
<Binding ElementName="ViewWin" Path="ViewPath.Item1" Mode="OneWay"/>
<Binding ElementName="ViewWin" Path="ViewPath.Item2" Mode="OneWay"/>
</MultiBinding>
</Window.Title>
<Window.Resources>
<local:CenterConverter x:Key="CenterConverter"/>
<local:ResourceConverter x:Key="ResourceConverter"/>
<DrawingBrush x:Key="BR_DarkCheckerboard" TileMode="Tile" Viewport="0,0,16,16" ViewportUnits="Absolute">
<DrawingBrush.Drawing>
<GeometryDrawing Geometry="M0,0 H1 V1 H2 V2 H1 V1 H0Z" Brush="#FF080808"/>
</DrawingBrush.Drawing>
</DrawingBrush>
<LinearGradientBrush x:Key="BR_DarkLinear" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="#FF222222" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="BR_Black" Color="Black"/>
<SolidColorBrush x:Key="BR_Grey" Color="#FF333333"/>
<SolidColorBrush x:Key="BR_White" Color="White"/>
<Style x:Key="NavPanelStyle" TargetType="Panel">
<EventSetter Event="PreviewMouseUp" Handler="DockPanel_PreviewMouseUp"/>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="#33AAAAAA" />
<Setter Property="Panel.ZIndex" Value="10" />
<Setter Property="Opacity" Value="0" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource SB_FadeIn}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource SB_FadeOut}"/>
</Trigger.ExitActions>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Window.Background>
<MultiBinding Converter="{StaticResource ResourceConverter}" ConverterParameter="BR_{0}" FallbackValue="{StaticResource BackgroundDarkBrush}">
<Binding Source="{x:Static local:App.Setting}" Path="ViewerBackground" FallbackValue="{StaticResource BackgroundDarkBrush}" Mode="OneWay"/>
<Binding RelativeSource="{RelativeSource Self}" Mode="OneTime"/>
</MultiBinding>
</Window.Background>
<Canvas x:Name="CA" Background="Transparent"
PreviewMouseWheel="CA_PreviewMouseWheel"
PreviewMouseUp="CA_PreviewMouseUp">
<DockPanel x:Name="DP_NavLeft" Style="{StaticResource NavPanelStyle}"
Width="{Binding ActualWidth, ElementName=CA, Converter={StaticResource MathMultiplyConverter}, ConverterParameter=0.1, Mode=OneWay}"
Height="{Binding ActualHeight,ElementName=CA, Mode=OneWay}"
Canvas.Left="0">
<fa:FontAwesome Icon="Solid_ChevronLeft" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="24"/>
</DockPanel>
<DockPanel x:Name="DP_NavRight" Style="{StaticResource NavPanelStyle}"
Width="{Binding ActualWidth, ElementName=CA, Converter={StaticResource MathMultiplyConverter}, ConverterParameter=0.1, Mode=OneWay}"
Height="{Binding ActualHeight,ElementName=CA, Mode=OneWay}"
Canvas.Right="0">
<fa:FontAwesome Icon="Solid_ChevronRight" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="24"/>
</DockPanel>
<local:DpiImage x:Name="IM" Stretch="Fill" RenderOptions.BitmapScalingMode="HighQuality" RenderTransformOrigin="0.5 0.5"
PreviewMouseUp="IM_PreviewMouseUp" PreviewMouseDown="IM_PreviewMouseDown"
PreviewMouseMove="IM_PreviewMouseMove"
Source="{Binding ElementName=ViewWin, Path=ViewImageSource, Mode=OneWay}">
<Canvas.Left>
<MultiBinding Converter="{StaticResource CenterConverter}" Mode="OneWay">
<Binding ElementName="CA" Path="ActualWidth" Mode="OneWay"/>
<Binding ElementName="IM" Path="ActualWidth" Mode="OneWay"/>
</MultiBinding>
</Canvas.Left>
<Canvas.Top>
<MultiBinding Converter="{StaticResource CenterConverter}" Mode="OneWay">
<Binding ElementName="CA" Path="ActualHeight" Mode="OneWay"/>
<Binding ElementName="IM" Path="ActualHeight" Mode="OneWay"/>
</MultiBinding>
</Canvas.Top>
<local:DpiImage.RenderTransform>
<TransformGroup>
<TranslateTransform x:Name="IM_TT"/>
<ScaleTransform/>
</TransformGroup>
</local:DpiImage.RenderTransform>
<local:DpiImage.Effect>
<BlurEffect Radius="0"/>
</local:DpiImage.Effect>
<local:DpiImage.Resources>
<Storyboard x:Key="SB_Trans_ZoomFade_Out">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="0"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleX" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="{Binding ElementName=ViewWin, Path=TransParams.Item1.Double1, Mode=OneWay}"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleY" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="{Binding ElementName=ViewWin, Path=TransParams.Item1.Double1, Mode=OneWay}"/>
</Storyboard>
<Storyboard x:Key="SB_Trans_ZoomFade_In">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleX" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleY" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
</Storyboard>
<Storyboard x:Key="SB_Trans_ZoomFadeBlur_Out">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="0"/>
<DoubleAnimation Storyboard.TargetProperty="Effect.Radius" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="20"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleX" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="{Binding ElementName=ViewWin, Path=TransParams.Item1.Double1, Mode=OneWay}"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleY" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="{Binding ElementName=ViewWin, Path=TransParams.Item1.Double1, Mode=OneWay}"/>
</Storyboard>
<Storyboard x:Key="SB_Trans_ZoomFadeBlur_In">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
<DoubleAnimation Storyboard.TargetProperty="Effect.Radius" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="0"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleX" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleY" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
</Storyboard>
<Storyboard x:Key="SB_Trans_Fade_Out">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseInOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="0"/>
</Storyboard>
<Storyboard x:Key="SB_Trans_Fade_In">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
</Storyboard>
<Storyboard x:Key="SB_Trans_HorizontalSwipe_Out">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseIn}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="0"/>
<DoubleAnimation Storyboard.TargetProperty="Effect.Radius" EasingFunction="{StaticResource CE_EaseIn}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="40"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[0].X" EasingFunction="{StaticResource CE_EaseIn}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="{Binding ElementName=ViewWin, Path=TransParams.Item1.Double2, Mode=OneWay}"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleX" EasingFunction="{StaticResource CE_EaseIn}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="0.9"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleY" EasingFunction="{StaticResource CE_EaseIn}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item1.Duration1, Mode=OneWay}"
To="0.9"/>
</Storyboard>
<Storyboard x:Key="SB_Trans_HorizontalSwipe_In">
<DoubleAnimation Storyboard.TargetProperty="Opacity" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
<DoubleAnimation Storyboard.TargetProperty="Effect.Radius" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="0"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[0].X" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
From="{Binding ElementName=ViewWin, Path=TransParams.Item2.Double1, Mode=OneWay}"
To="{Binding ElementName=ViewWin, Path=TransParams.Item2.Double2, Mode=OneWay}"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleX" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.Children[1].ScaleY" EasingFunction="{StaticResource CE_EaseOut}"
Duration="{Binding ElementName=ViewWin, Path=TransParams.Item2.Duration1, Mode=OneWay}"
To="1"/>
</Storyboard>
</local:DpiImage.Resources>
</local:DpiImage>
<local:BubbleMessage x:Name="BM">
<Canvas.Left>
<MultiBinding Converter="{StaticResource CenterConverter}" Mode="OneWay">
<Binding ElementName="CA" Path="ActualWidth" Mode="OneWay"/>
<Binding ElementName="BM" Path="ActualWidth" Mode="OneWay"/>
</MultiBinding>
</Canvas.Left>
<Canvas.Top>
<MultiBinding Converter="{StaticResource CenterConverter}" Mode="OneWay">
<Binding ElementName="CA" Path="ActualHeight" Mode="OneWay"/>
<Binding ElementName="BM" Path="ActualHeight" Mode="OneWay"/>
</MultiBinding>
</Canvas.Top>
</local:BubbleMessage>
</Canvas>
</local:BorderlessWindow>