Repository navigation
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
482 lines (458 loc) · 26.8 KB
/
Copy pathMainWindow.xaml
File metadata and controls
482 lines (458 loc) · 26.8 KB
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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
<Window x:Class="EmailHeaderAnalyzer.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:EmailHeaderAnalyzer"
mc:Ignorable="d"
Title="Email Header Analyzer"
Icon="pack://application:,,,/AppIcon.ico"
Height="800" Width="1200"
MinHeight="600" MinWidth="900"
WindowStartupLocation="CenterScreen"
Background="{DynamicResource ThemeBackground}"
AllowDrop="True"
Drop="Window_Drop"
DragOver="Window_DragOver">
<Window.Resources>
<!-- Modern Button Style -->
<Style x:Key="ModernButton" TargetType="Button">
<Setter Property="Background" Value="#0078D4"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Medium"/>
<Setter Property="Padding" Value="12,8"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#106EBE"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#005A9E"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#CCCCCC"/>
<Setter Property="Foreground" Value="#666666"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Secondary Button Style -->
<Style x:Key="SecondaryButton" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource ThemeWindowBackground}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeTextColor}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="12,8"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderColor}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ThemeHoverBackground}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource ThemePressedBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Copy Button Style -->
<Style x:Key="CopyButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Width" Value="20"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="ToolTip" Value="Copy to clipboard"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="2">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource ThemeHoverBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ComboBox Style -->
<Style x:Key="ThemedComboBox" TargetType="ComboBox">
<Setter Property="Background" Value="{DynamicResource ThemeWindowBackground}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeTextColor}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderColor}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="5,3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Name="ToggleButton"
Grid.Column="2"
Focusable="false"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<Border x:Name="Border"
Grid.ColumnSpan="2"
Background="{DynamicResource ThemeWindowBackground}"
BorderBrush="{DynamicResource ThemeBorderColor}"
BorderThickness="1" />
<Path x:Name="Arrow"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z"
Fill="{DynamicResource ThemeTextColor}" />
</Grid>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<ContentPresenter Name="ContentSite"
IsHitTestVisible="False"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
Margin="3,3,23,3"
VerticalAlignment="Center"
HorizontalAlignment="Left" />
<Popup Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder"
Background="{DynamicResource ThemeWindowBackground}"
BorderBrush="{DynamicResource ThemeBorderColor}"
BorderThickness="1" />
<ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeTextColor}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="5,3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Border"
Padding="2"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="true">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="true">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeHoverBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
<!-- TabControl Style -->
<Style x:Key="ThemedTabControl" TargetType="TabControl">
<Setter Property="Background" Value="{DynamicResource ThemeBackground}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderColor}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeTextColor}"/>
</Style>
<!-- TabItem Style -->
<Style x:Key="ThemedTabItem" TargetType="TabItem">
<Setter Property="Background" Value="{DynamicResource ThemeWindowBackground}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeTextColor}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Grid>
<Border Name="Border"
Background="{DynamicResource ThemeWindowBackground}"
BorderBrush="{DynamicResource ThemeBorderColor}"
BorderThickness="1,1,1,0"
CornerRadius="4,4,0,0"
Margin="0,0,2,0">
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"
Margin="12,2,12,2"/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeBackground}"/>
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0"/>
<Setter TargetName="Border" Property="Margin" Value="0,0,2,-1"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeTextColor}"/>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeWindowBackground}"/>
<Setter Property="Foreground" Value="{DynamicResource ThemeSecondaryTextColor}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeHoverBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Expander Style -->
<Style x:Key="ModernExpander" TargetType="Expander">
<Setter Property="Background" Value="{DynamicResource ThemeWindowBackground}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderColor}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="0,5"/>
<Setter Property="Padding" Value="10"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header Section -->
<Border Grid.Row="0" Background="{DynamicResource ThemeBackground}" BorderBrush="{DynamicResource ThemeBorderColor}" BorderThickness="0,0,0,1">
<StackPanel Margin="20,15">
<DockPanel>
<TextBlock Text="Email Header Analyzer" FontSize="24" FontWeight="SemiBold" Foreground="{DynamicResource ThemeTextColor}"/>
<TextBlock DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center">
<Hyperlink Click="AboutLink_Click" Foreground="{DynamicResource ThemeSecondaryTextColor}">v1.0.0 — About</Hyperlink>
</TextBlock>
</DockPanel>
<!-- Tab Control for Input Mode -->
<TabControl x:Name="tabInput" Margin="0,15,0,0" Style="{StaticResource ThemedTabControl}">
<!-- File Input Tab -->
<TabItem Header="File Input" Style="{StaticResource ThemedTabItem}">
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border x:Name="dropZone"
Grid.Column="0"
BorderBrush="{DynamicResource ThemeBorderColor}"
BorderThickness="1"
CornerRadius="4"
Background="{DynamicResource ThemeBackground}"
AllowDrop="True"
Drop="DropZone_Drop"
DragEnter="DropZone_DragEnter"
DragLeave="DropZone_DragLeave"
DragOver="DropZone_DragOver">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="txtFilePath"
Grid.Column="0"
VerticalAlignment="Center"
Padding="10,8"
BorderThickness="0"
IsReadOnly="True"
Background="Transparent"
Foreground="{DynamicResource ThemeSecondaryTextColor}"
Text="Select an email file (.msg or .eml) or drag & drop here..."/>
<Button Grid.Column="1"
x:Name="btnBrowse"
Content="Browse..."
Style="{StaticResource SecondaryButton}"
Margin="5"
Click="BtnBrowse_Click"/>
</Grid>
</Border>
<Button Grid.Column="1"
x:Name="btnAnalyzeFile"
Content="Analyze"
Style="{StaticResource ModernButton}"
Margin="10,0,0,0"
MinWidth="100"
IsEnabled="False"
Click="BtnAnalyze_Click"/>
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="20,0,0,0">
<CheckBox x:Name="chkVerbose"
Content="Show All Headers"
VerticalAlignment="Center"
Margin="0,0,15,0"
Foreground="{DynamicResource ThemeTextColor}"
IsChecked="True"/>
<CheckBox x:Name="chkJsonOutput"
Content="JSON Output"
VerticalAlignment="Center"
Foreground="{DynamicResource ThemeTextColor}"/>
</StackPanel>
</Grid>
</TabItem>
<!-- Text Input Tab -->
<TabItem Header="Text Input" Style="{StaticResource ThemedTabItem}">
<Grid Margin="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="150"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="Paste email headers below (copy from View Source or Show Original options in email clients):"
Foreground="{DynamicResource ThemeTextColor}"
Margin="0,0,0,5"/>
<Border Grid.Row="1" BorderBrush="{DynamicResource ThemeBorderColor}" BorderThickness="1" CornerRadius="4">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<TextBox x:Name="txtHeaderInput"
AcceptsReturn="True"
TextWrapping="NoWrap"
FontFamily="Consolas"
FontSize="12"
Padding="10"
Background="{DynamicResource ThemeWindowBackground}"
Foreground="{DynamicResource ThemeTextColor}"
BorderThickness="0"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
TextChanged="TxtHeaderInput_TextChanged"/>
</ScrollViewer>
</Border>
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,10,0,0">
<Button x:Name="btnAnalyzeText"
Content="Analyze Headers"
Style="{StaticResource ModernButton}"
MinWidth="120"
IsEnabled="False"
Click="BtnAnalyzeText_Click"/>
<Button x:Name="btnClearText"
Content="Clear"
Style="{StaticResource SecondaryButton}"
Margin="10,0,0,0"
MinWidth="80"
Click="BtnClearText_Click"/>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
</StackPanel>
</Border>
<!-- Results Section -->
<ScrollViewer Grid.Row="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
Background="{DynamicResource ThemeBackground}">
<StackPanel x:Name="resultsPanel" Margin="20">
<!-- Results will be added here dynamically -->
<TextBlock x:Name="placeholderText"
Text="Select an email file and click Analyze to view header information"
FontSize="16"
Foreground="{DynamicResource ThemeSecondaryTextColor}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0,100,0,0"/>
</StackPanel>
</ScrollViewer>
<!-- Status Bar -->
<Border Grid.Row="2" Background="{DynamicResource ThemeBackground}" BorderBrush="{DynamicResource ThemeBorderColor}" BorderThickness="0,1,0,0">
<Grid Margin="20,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<ComboBox x:Name="cmbExportFormat"
Width="80"
Margin="0,0,5,0"
SelectedIndex="0"
IsEnabled="False"
Style="{StaticResource ThemedComboBox}">
<ComboBoxItem Content="HTML"/>
<ComboBoxItem Content="TXT"/>
<ComboBoxItem Content="JSON"/>
<ComboBoxItem Content="CSV"/>
</ComboBox>
<Button x:Name="btnExport"
Content="Export"
Style="{StaticResource SecondaryButton}"
Margin="0,0,10,0"
IsEnabled="False"
Click="BtnExport_Click"/>
</StackPanel>
<Button Grid.Column="1"
x:Name="btnCopyAll"
Content="Copy All"
Style="{StaticResource SecondaryButton}"
IsEnabled="False"
Click="BtnCopyAll_Click"/>
<TextBlock Grid.Column="2"
x:Name="statusText"
Text="Ready"
VerticalAlignment="Center"
Margin="20,0,0,0"
Foreground="#107C10"/>
<ProgressBar Grid.Column="3"
x:Name="progressBar"
Width="200"
Height="4"
Visibility="Collapsed"
IsIndeterminate="True"/>
</Grid>
</Border>
</Grid>
</Window>