-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainPage.xaml
425 lines (406 loc) · 20.3 KB
/
MainPage.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="IconExtractor.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctrls="using:IconExtractor.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:IconExtractor.Support"
xmlns:local="using:IconExtractor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="using:IconExtractor.Models"
x:Name="hostPage"
Background="Transparent"
mc:Ignorable="d">
<Page.Resources>
<StaticResource x:Key="GridViewItemBackgroundSelected" ResourceKey="AccentFillColorDefaultBrush" />
<StaticResource x:Key="GridViewItemBackgroundSelectedPointerOver" ResourceKey="AccentFillColorSecondaryBrush" />
<StaticResource x:Key="GridViewItemForegroundSelected" ResourceKey="TextOnAccentFillColorPrimaryBrush" />
<DataTemplate x:Key="IconTemplate" x:DataType="models:IconIndexItem">
<UserControl PointerPressed="IconsOnTemplatePointerPressed">
<Border
x:Name="borderItem"
MinWidth="70"
MinHeight="50"
Margin="6"
Padding="4"
Background="#10000000"
BorderBrush="{ThemeResource BorderBrush}"
BorderThickness="1"
CornerRadius="5">
<!--
We need some level of background set so the hit test is valid
for the tooltip and the state manager, hence the #10000000.
-->
<ToolTipService.ToolTip>
<ToolTip Background="{ThemeResource GradientToolTipBrush}">
<StackPanel
Background="Transparent"
BorderThickness="0"
CornerRadius="5"
Orientation="Vertical"
Spacing="2">
<TextBlock
Margin="1"
FontFamily="{ThemeResource SecondaryFont}"
FontSize="{ThemeResource FontSizeMedium}"
Text="{x:Bind local:Functions.IdFormatter(IconIndex), Mode=OneWay}" />
<Image
Width="64"
Height="64"
Source="{x:Bind IconImage, Mode=OneWay}"
ToolTipService.ToolTip="{x:Bind local:Functions.IdFormatter(IconIndex), Mode=OneWay}" />
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
<Grid x:Name="gridItem">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="IndexColumn" Width="32" />
<ColumnDefinition x:Name="ImageColumn" Width="45" />
</Grid.ColumnDefinitions>
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="FontFamily" Value="{StaticResource PrimaryFont}" />
<Setter Property="Foreground" Value="{ThemeResource PrimaryBrush}" />
<Setter Property="FontSize" Value="{StaticResource FontSizeSmall}" />
</Style>
</Grid.Resources>
<TextBlock
Grid.Column="0"
Margin="3,0,1,0"
Foreground="{ThemeResource SecondaryBrush}"
Text="{x:Bind IconIndex, Mode=OneWay}" />
<Image
Grid.Column="1"
Width="32"
Height="32"
Source="{x:Bind IconImage, Mode=OneWay}" />
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="SelectionState">
<VisualState x:Name="Default" />
<VisualState x:Name="Selected">
<VisualState.Setters>
<Setter Target="borderItem.Background" Value="{ThemeResource GradientBorderBrush}" />
<Setter Target="borderItem.BorderBrush" Value="{ThemeResource AccentFillColorDefaultBrush}" />
<Setter Target="borderItem.BorderThickness" Value="2" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Border>
</UserControl>
</DataTemplate>
</Page.Resources>
<Grid x:Name="hostGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="105" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="0"
Margin="15"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="15">
<!--
You can could change this to a TextBox and allow the user to enter the path of the DLL manually.
-->
<ComboBox
MinWidth="200"
MaxWidth="200"
HorizontalAlignment="Left"
ItemsSource="{x:Bind dlls, Mode=OneWay}"
SelectedIndex="{x:Bind SelectedDLLIndex, Mode=OneWay}"
SelectionChanged="ComboBox_SelectionChanged"
SelectionChangedTrigger="Always">
<ComboBox.Header>
<TextBlock
Margin="2,0,0,-5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{ThemeResource GradientHeaderBrush}"
Text="Select common DLL" />
</ComboBox.Header>
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="3">
<TextBlock Text="{Binding}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock
Margin="5,0,0,1"
VerticalAlignment="Bottom"
FontFamily="{ThemeResource PrimaryFont}"
FontSize="{ThemeResource FontSizeLarge}"
Foreground="{ThemeResource GradientTitleBrush}"
Text="{x:Bind Status, Mode=OneWay}" />
<Button
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Command="{x:Bind DebugCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Mode=OneWay}"
Content="⏱️"
FontSize="24"
Style="{StaticResource ToolbarButton}" />
</StackPanel>
<StackPanel
x:Name="spControls"
Grid.Row="1"
Margin="15"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="15">
<Button
Command="{x:Bind TraverseCommand, Mode=OneWay}"
IsEnabled="{x:Bind IsNotBusy, Mode=OneWay}"
Style="{ThemeResource EnhancedButton}">
<Button.Content>
<StackPanel Orientation="Horizontal" Spacing="9">
<Image
Width="24"
Height="24"
helpers:ImageFromBytes.SourceBytes="{x:Bind SearchIconFileInfo.IconData, Mode=OneWay}" />
<!-- Example of applying icon data directly to image control in XAML. -->
<TextBlock
VerticalAlignment="Center"
FontFamily="{ThemeResource PrimaryFont}"
FontSize="{ThemeResource FontSizeMedium}"
Text="Load all icons" />
</StackPanel>
</Button.Content>
</Button>
<Image
x:Name="imgCycle"
Width="24"
Height="24"
Margin="3"
Source="{x:Bind ImgSource, Mode=OneWay}" />
<Button Command="{x:Bind TestCommand, Mode=OneWay}" Style="{ThemeResource EnhancedButton}">
<Button.Content>
<StackPanel Orientation="Horizontal" Spacing="9">
<Image
Width="24"
Height="24"
helpers:ImageFromBytes.SourceBytes="{x:Bind LandscapeIconFileInfo.IconData, Mode=OneWay}" />
<!-- Example of applying icon data directly to image control in XAML. -->
<TextBlock
VerticalAlignment="Center"
FontFamily="{ThemeResource PrimaryFont}"
FontSize="{ThemeResource FontSizeMedium}"
Text="Icon for button" />
</StackPanel>
</Button.Content>
</Button>
<!--#region [Width and Height]-->
<CheckBox
Margin="0,0,10,0"
Content="Save each icon to disk"
IsChecked="{x:Bind SaveToDisk, Mode=TwoWay}" />
<TextBox
GotFocus="TextBox_GotFocus"
Text="{x:Bind TargetWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="{x:Bind SaveToDisk, Mode=OneWay, Converter={StaticResource BooleanVisibilityInverse}}">
<TextBox.Header>
<StackPanel Orientation="Horizontal" Spacing="6">
<TextBlock
Margin="1,0,0,-6"
Foreground="{ThemeResource GradientTitleBrush}"
Text="Desired width" />
<ctrls:GridEx>
<Image
Width="16"
Height="16"
VerticalAlignment="Bottom"
Source="ms-appx:///Assets/Info.png">
<ToolTipService.ToolTip>
<ToolTip Background="{ThemeResource GradientToolTipBrush}">
<StackPanel
Background="Transparent"
BorderThickness="0"
CornerRadius="5"
Orientation="Vertical">
<TextBlock FontSize="{ThemeResource FontSizeNormal}" Text="Some asset widths may not be available," />
<TextBlock FontSize="{ThemeResource FontSizeNormal}" Text="you'll have to experiment with these values." />
<TextBlock
FontSize="{ThemeResource FontSizeSmall}"
FontStyle="Italic"
Text="Typical values are 16, 24, 32, 48, 64, 128 and 256." />
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
</Image>
</ctrls:GridEx>
</StackPanel>
</TextBox.Header>
</TextBox>
<!-- https://symbl.cc/en/unicode-table/#dingbats -->
<TextBlock
Margin="-9,0,-9,5"
VerticalAlignment="Bottom"
FontSize="{ThemeResource FontSizeNormal}"
Text="✖"
Visibility="{x:Bind SaveToDisk, Mode=OneWay, Converter={StaticResource BooleanVisibilityInverse}}" />
<TextBox
GotFocus="TextBox_GotFocus"
Text="{x:Bind TargetHeight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
ToolTipService.ToolTip="Some asset heights may not be available"
Visibility="{x:Bind SaveToDisk, Mode=OneWay, Converter={StaticResource BooleanVisibilityInverse}}">
<TextBox.Header>
<StackPanel Orientation="Horizontal" Spacing="6">
<TextBlock
Margin="1,0,0,-6"
Foreground="{ThemeResource GradientTitleBrush}"
Text="Desired height" />
<ctrls:GridEx>
<Image
Width="16"
Height="16"
VerticalAlignment="Bottom"
Source="ms-appx:///Assets/Info.png">
<ToolTipService.ToolTip>
<ToolTip Background="{ThemeResource GradientToolTipBrush}">
<StackPanel
Background="Transparent"
BorderThickness="0"
CornerRadius="5"
Orientation="Vertical">
<TextBlock FontSize="{ThemeResource FontSizeNormal}" Text="Some asset heights may not be available," />
<TextBlock FontSize="{ThemeResource FontSizeNormal}" Text="you'll have to experiment with these values." />
<TextBlock
FontSize="{ThemeResource FontSizeSmall}"
FontStyle="Italic"
Text="Typical values are 16, 24, 32, 48, 64, 128 and 256." />
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
</Image>
</ctrls:GridEx>
</StackPanel>
</TextBox.Header>
</TextBox>
<!--#endregion-->
</StackPanel>
<Image
Grid.Row="2"
Width="140"
Height="140"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Opacity="0.8"
Source="ms-appx:///Assets/Spinner.png"
Visibility="{x:Bind IsNotBusy, Mode=OneWay, Converter={StaticResource BooleanVisibility}}">
<Image.Resources>
<Storyboard
x:Name="StoryboardPath"
AutoReverse="False"
RepeatBehavior="Forever">
<DoubleAnimation
x:Name="dblAnimation"
Storyboard.TargetName="spinnerTransform"
Storyboard.TargetProperty="Angle"
From="0"
To="360"
Duration="0:00:01.2" />
</Storyboard>
</Image.Resources>
<Image.RenderTransform>
<RotateTransform x:Name="spinnerTransform" CenterX="69" CenterY="70" />
</Image.RenderTransform>
</Image>
<!--<Ellipse
Width="50"
Height="100"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Ellipse.Fill>
<ImageBrush ImageSource="ms-appx:///Assets/StoreLogo.png" />
</Ellipse.Fill>
</Ellipse>-->
<ScrollViewer
Grid.Row="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AutomationProperties.Name="Icons">
<ItemsRepeater
x:Name="IconsRepeater"
MinWidth="100"
Margin="10"
HorizontalAlignment="Stretch"
ItemTemplate="{StaticResource IconTemplate}">
<ItemsRepeater.Layout>
<UniformGridLayout Orientation="Horizontal" />
</ItemsRepeater.Layout>
</ItemsRepeater>
</ScrollViewer>
<!-- AutoCloseInfoBar -->
<ctrls:AutoCloseInfoBar
x:Name="infoBar"
Grid.Row="2"
Margin="6"
VerticalAlignment="Bottom"
AutoCloseInterval="7000"
IsOpen="False"
Severity="Informational">
<ctrls:AutoCloseInfoBar.ActionButton>
<DropDownButton HorizontalAlignment="Right" VerticalAlignment="Center">
<TextBlock
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Text="" />
<DropDownButton.Flyout>
<MenuFlyout x:Name="flyout" Placement="TopEdgeAlignedLeft">
<MenuFlyoutItem
Command="{x:Bind AboutCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}, Mode=OneWay}"
Text="Show assemblies">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
</ctrls:AutoCloseInfoBar.ActionButton>
</ctrls:AutoCloseInfoBar>
<!-- Referenced Assemblies Dialog -->
<ContentDialog
x:Name="contentDialog"
Width="470"
CloseButtonText="OK">
<!-- Title Style -->
<ContentDialog.TitleTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image
Height="50"
Shadow="{ThemeResource CommandBarFlyoutOverflowShadow}"
Source="/Assets/Info.png" />
<TextBlock
Margin="9,0"
VerticalAlignment="Center"
Shadow="{ThemeResource CommandBarFlyoutOverflowShadow}"
Text="Referenced Assemblies" />
</StackPanel>
</DataTemplate>
</ContentDialog.TitleTemplate>
<!-- Button Style -->
<ContentDialog.CloseButtonStyle>
<Style TargetType="Button">
<!-- <Setter Property="Background" Value="{ThemeResource SecondaryBrush}" /> -->
<Setter Property="CornerRadius" Value="4" />
</Style>
</ContentDialog.CloseButtonStyle>
<ScrollViewer MaxHeight="300">
<TextBlock x:Name="tbAssemblies" TextWrapping="WrapWholeWords" />
</ScrollViewer>
</ContentDialog>
</Grid>
</Page>