-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMainWindow.xaml
337 lines (323 loc) · 17 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
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
<Window
x:Class="ResxUnusedFinder.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:command="http://www.galasoft.ch/mvvmlight"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:prop="clr-namespace:ResxUnusedFinder.Properties"
Title="RESX Unused Finder"
Width="650"
Height="450"
MinWidth="600"
MinHeight="300"
Closing="Window_Closing">
<Window.Resources>
<Style x:Key="FieldLabel" TargetType="TextBlock">
<Setter Property="Margin" Value="4 0 4 0" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="SectionHeader" TargetType="TextBlock">
<Setter Property="Margin" Value="0 0 0 0" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style x:Key="BrowseButton" TargetType="Button">
<Setter Property="Margin" Value="6 0 0 0" />
<Setter Property="Padding" Value="6 1" />
</Style>
<Style x:Key="ActionButton" TargetType="Button">
<Setter Property="Margin" Value="6 0 0 0" />
<Setter Property="Padding" Value="6 1" />
</Style>
<Style x:Key="Field" TargetType="TextBox">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="LongToolTip" TargetType="TextBlock">
<Setter Property="Width" Value="300" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</Window.Resources>
<Grid Name="RootGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Vertical">
<Border Background="WhiteSmoke" Padding="6">
<StackPanel Orientation="Vertical">
<Grid ToolTipService.ShowDuration="20000">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="The root project folder that contains all possible string references." />
</Grid.ToolTip>
<TextBlock
Margin="0 0 6 0"
Style="{StaticResource FieldLabel}"
Text="Project folder:" />
<TextBox Grid.Column="1" Text="{Binding ProjectFolder}" />
<Button
Grid.Column="2"
Command="{Binding BrowseFolderCommand}"
Content="Browse..."
Style="{StaticResource BrowseButton}" />
</Grid>
<TextBlock
Margin="0 8 0 0"
Style="{StaticResource SectionHeader}"
Text="Definitions" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource FieldLabel}" Text="Resource file:" />
<TextBox Grid.Column="1" Text="{Binding ResourceFile}" />
<Button
Grid.Column="2"
Command="{Binding BrowseResourceFileCommand}"
Content="Browse..."
Style="{StaticResource BrowseButton}" />
</Grid>
<TextBlock
Margin="0 8 0 0"
Style="{StaticResource SectionHeader}"
Text="References" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="Auto" />
<RowDefinition Height="24" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Style="{StaticResource FieldLabel}"
Text="Extensions:"
ToolTipService.ShowDuration="20000">
<TextBlock.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static prop:Resources.ExtensionsToolTip}" />
</TextBlock.ToolTip>
</TextBlock>
<TextBox
Grid.Row="0"
Grid.Column="1"
Style="{StaticResource Field}"
Text="{Binding Extensions}"
ToolTipService.ShowDuration="20000">
<TextBox.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static prop:Resources.ExtensionsToolTip}" />
</TextBox.ToolTip>
</TextBox>
<StackPanel
Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Top"
Orientation="Vertical">
<TextBlock
Style="{StaticResource FieldLabel}"
Text="Reference Formats:"
ToolTipService.ShowDuration="20000">
<TextBlock.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static prop:Resources.ReferenceFormatsToolTip}" />
</TextBlock.ToolTip>
</TextBlock>
<CheckBox
Margin="10 2 0 0"
Content="Use Regex"
IsChecked="{Binding UseRegex}" />
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="1"
Orientation="Vertical">
<ItemsControl Canvas.ZIndex="3" ItemsSource="{Binding ReferenceFormats}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Text="{Binding Value}" />
<Button
Grid.Column="1"
Margin="2 0 0 0"
Command="{Binding DataContext.RemoveReferenceFormatCommand,
ElementName=RootGrid}"
CommandParameter="{Binding}"
Content="X"
FontWeight="Bold"
Foreground="Red"
Padding="4 0"
ToolTip="Remove reference format"
Visibility="{Binding DataContext.CanRemoveReferenceFormat,
ElementName=RootGrid,
Converter={StaticResource VisibilityConverter}}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button
HorizontalAlignment="Left"
Canvas.ZIndex="2"
Command="{Binding AddReferenceFormatCommand}"
Padding="5 0">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0 -10 2 -4"
FontSize="23"
FontWeight="Bold"
Foreground="Green"
Text="+" />
<TextBlock Text="Add reference format" />
</StackPanel>
</Button>
</StackPanel>
<!--<TextBox
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource Field}"
Text="{Binding ReferenceFormats}"
ToolTipService.ShowDuration="20000">
<TextBox.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static prop:Resources.ReferenceFormatsToolTip}" />
</TextBox.ToolTip>
</TextBox>-->
<TextBlock
Grid.Row="2"
Grid.Column="0"
Style="{StaticResource FieldLabel}"
Text="Excluded Key Prefixes:"
ToolTipService.ShowDuration="20000">
<TextBlock.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static prop:Resources.ExcludedPrefixesToolTip}" />
</TextBlock.ToolTip>
</TextBlock>
<TextBox
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource Field}"
Text="{Binding ExcludePrefixes}"
ToolTipService.ShowDuration="20000">
<TextBox.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{x:Static prop:Resources.ExcludedPrefixesToolTip}" />
</TextBox.ToolTip>
</TextBox>
</Grid>
<Grid Margin="0 8 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Style="{StaticResource SectionHeader}" Text="Unused Resources" />
<Button Command="{Binding RefreshCommand}" Style="{StaticResource ActionButton}">
<StackPanel Orientation="Horizontal">
<Image
Width="16"
Height="16"
Source="/Icons/refresh.png" />
<TextBlock Margin="2 0 0 0" Text="Refresh" />
</StackPanel>
</Button>
<Button
Command="{Binding CopyCommand}"
Style="{StaticResource ActionButton}"
UseLayoutRounding="True">
<StackPanel Orientation="Horizontal">
<Image
Width="16"
Height="16"
Source="/Icons/copy.png" />
<TextBlock Margin="2 0 0 0" Text="Copy" />
</StackPanel>
</Button>
<Button Command="{Binding DeleteAllCommand}" Style="{StaticResource ActionButton}">
<StackPanel Orientation="Horizontal">
<Image
Width="16"
Height="16"
Source="/Icons/delete.png" />
<TextBlock Margin="2 0 0 0" Text="Delete All" />
</StackPanel>
</Button>
</StackPanel>
<StackPanel
Grid.Column="1"
Orientation="Horizontal"
Visibility="{Binding ItemsSelected,
Converter={StaticResource VisibilityConverter}}">
<Button
Command="{Binding ExcludeSelectedCommand}"
Content="Exclude Selected"
Style="{StaticResource ActionButton}" />
<Button Command="{Binding DeleteSelectedCommand}" Style="{StaticResource ActionButton}">
<StackPanel Orientation="Horizontal">
<Image
Width="16"
Height="16"
Source="/Icons/delete.png" />
<TextBlock Margin="2 0 0 0" Text="Delete Selected" />
</StackPanel>
</Button>
</StackPanel>
</Grid>
</StackPanel>
</Border>
</StackPanel>
<ListView Grid.Row="1" ItemsSource="{Binding UnusedResources}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<command:EventToCommand Command="{Binding OnSelectionChangedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn
x:Name="keyColumn"
Width="200"
DisplayMemberBinding="{Binding Key}"
Header="Key" />
<GridViewColumn
x:Name="valueColumn"
Width="350"
Header="Value">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}" ToolTipService.ShowDuration="20000">
<TextBlock.ToolTip>
<TextBlock Style="{StaticResource LongToolTip}" Text="{Binding Value}" />
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</GridView>
</ListView.View>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
<TextBlock
Grid.Row="2"
Margin="3"
Background="WhiteSmoke"
Text="{Binding Status}" />
</Grid>
</Window>