Repository navigation
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
401 lines (372 loc) · 22.5 KB
/
Copy pathMainWindow.xaml
File metadata and controls
401 lines (372 loc) · 22.5 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
<Window x:Class="OneNoteExporter.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Icon="icon.ico"
Title="OneNote Backup Exporter"
Width="900" Height="800"
MinWidth="700" MinHeight="500"
MaxWidth="1280" MaxHeight="1100"
WindowStartupLocation="CenterScreen"
Loaded="Window_Loaded"
Closing="Window_Closing"
Background="{StaticResource BgPage}">
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- Header -->
<RowDefinition Height="*"/> <!-- Notebook list -->
<RowDefinition Height="Auto"/> <!-- Export controls -->
</Grid.RowDefinitions>
<!-- ════════════════════════════════════════════════════════
ROW 0 – Header
════════════════════════════════════════════════════════ -->
<Border Grid.Row="0"
Background="{StaticResource BgCard}"
BorderBrush="{StaticResource BorderColor}"
BorderThickness="0,0,0,1"
CornerRadius="5,5,0,0"
Padding="15,10"
Margin="0,0,0,8">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="OneNote Backup Exporter"
FontSize="18" FontWeight="Bold"
Foreground="{StaticResource PrimaryBlue}"
VerticalAlignment="Center"/>
<!-- Version badge -->
<Border Grid.Column="1"
x:Name="VersionBadge"
Background="{StaticResource InfoBg}"
BorderBrush="{StaticResource InfoBorder}"
BorderThickness="1"
CornerRadius="4"
Padding="8,4"
VerticalAlignment="Center">
<TextBlock x:Name="VersionText"
Text="Checking OneNote installation..."
Foreground="{StaticResource InfoFg}"
FontSize="12"/>
</Border>
</Grid>
</Border>
<!-- ════════════════════════════════════════════════════════
ROW 1 – Notebook list
════════════════════════════════════════════════════════ -->
<Border Grid.Row="1"
Background="{StaticResource BgCard}"
BorderBrush="{StaticResource BorderColor}"
BorderThickness="1"
CornerRadius="5"
Padding="12"
Margin="0,0,0,8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Section header -->
<Grid Grid.Row="0" Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="Available Notebooks:"
FontSize="14" FontWeight="SemiBold"
Foreground="{StaticResource TextPrimary}"
VerticalAlignment="Center"/>
<Button Grid.Column="1"
x:Name="RefreshButton"
Content="Refresh"
Style="{StaticResource SmallButtonStyle}"
Click="RefreshButton_Click"/>
</Grid>
<!-- Notebook list area -->
<Grid Grid.Row="1">
<!-- The actual list -->
<Border Background="{StaticResource BgList}"
BorderBrush="{StaticResource BorderColor}"
BorderThickness="1"
CornerRadius="4">
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
Padding="8">
<ItemsControl x:Name="NotebookList">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Background="White"
BorderBrush="#E0E0E0"
BorderThickness="1"
CornerRadius="5"
Padding="10,8"
Margin="0,0,0,6">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{StaticResource ButtonBlue}"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel>
<!-- ── Notebook row: checkbox + expand button ── -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0"
IsChecked="{Binding IsSelected, Mode=TwoWay}"
IsEnabled="{Binding IsEnabled}"
Checked="Notebook_SelectionChanged"
Unchecked="Notebook_SelectionChanged"
Cursor="Hand">
<StackPanel Margin="4,0,0,0">
<TextBlock Text="{Binding DisplayName}"
FontWeight="SemiBold"
FontSize="13"
Foreground="{StaticResource TextPrimary}"/>
<TextBlock Text="{Binding LastModifiedFormatted}"
FontSize="11"
Foreground="{StaticResource TextSecondary}"
Margin="0,2,0,0"/>
</StackPanel>
</CheckBox>
<!-- Expand / collapse sections toggle -->
<Button Grid.Column="1"
Click="ExpandSections_Click"
Margin="8,0,0,0"
VerticalAlignment="Center">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ExpandButtonStyle}">
<Setter Property="Content" Value="▶ Sections"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsExpanded}" Value="True">
<Setter Property="Content" Value="▼ Sections"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</Grid>
<!-- ── Sections panel (visible when expanded) ── -->
<Border Margin="28,6,0,2"
BorderBrush="{StaticResource BorderColor}"
BorderThickness="0,0,0,0"
Visibility="{Binding IsExpanded, Converter={StaticResource BoolToVis}}">
<StackPanel>
<!-- Loading indicator -->
<StackPanel Orientation="Horizontal"
Margin="0,0,0,4"
Visibility="{Binding IsLoadingSections, Converter={StaticResource BoolToVis}}">
<TextBlock Text="⏳ Loading sections..."
FontSize="12"
FontStyle="Italic"
Foreground="{StaticResource TextSecondary}"/>
</StackPanel>
<!-- Section list -->
<ItemsControl ItemsSource="{Binding Sections}"
Visibility="{Binding IsSectionsContentVisible, Converter={StaticResource BoolToVis}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}"
Checked="Section_SelectionChanged"
Unchecked="Section_SelectionChanged"
Cursor="Hand"
Margin="0,3,0,3">
<TextBlock Text="{Binding DisplayName}"
FontSize="12"
Foreground="{StaticResource TextPrimary}"/>
</CheckBox>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- No sections found -->
<TextBlock Text="No exportable sections found."
FontSize="12"
FontStyle="Italic"
Foreground="{StaticResource TextSecondary}"
Margin="0,2,0,0"
Visibility="{Binding SectionsEmpty, Converter={StaticResource BoolToVis}}"/>
</StackPanel>
</Border>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Border>
<!-- Overlay: Loading -->
<TextBlock x:Name="LoadingText"
Text="Loading notebooks..."
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{StaticResource TextSecondary}"
FontSize="14"
Visibility="Collapsed"/>
<!-- Overlay: Empty -->
<TextBlock x:Name="EmptyText"
Text="No notebooks found"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="{StaticResource TextSecondary}"
FontSize="14"
Visibility="Collapsed"/>
<!-- Overlay: Error -->
<TextBlock x:Name="ErrorText"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#DC3545"
FontSize="13"
TextWrapping="Wrap"
Margin="15"
Visibility="Collapsed"/>
</Grid>
</Grid>
</Border>
<!-- ════════════════════════════════════════════════════════
ROW 2 – Export controls
════════════════════════════════════════════════════════ -->
<Border Grid.Row="2"
Background="{StaticResource BgCard}"
BorderBrush="{StaticResource BorderColor}"
BorderThickness="1"
CornerRadius="5"
Padding="12,10">
<StackPanel>
<!-- Destination path row -->
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- TextBox with placeholder overlay -->
<Grid Grid.Column="0" Margin="0,0,8,0">
<TextBox x:Name="DestPathBox"/>
<TextBlock Text="Destination folder (e.g. C:\Backup)"
Foreground="#AAAAAA"
Margin="10,0,0,0"
VerticalAlignment="Center"
IsHitTestVisible="False"
FontSize="13">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Text, ElementName=DestPathBox}" Value="">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
<Button Grid.Column="1"
x:Name="BrowseButton"
Content="Browse..."
Style="{StaticResource GrayButtonStyle}"
Click="BrowseButton_Click"/>
</Grid>
<!-- Format selector row -->
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="Export Format:"
VerticalAlignment="Center"
Margin="0,0,10,0"
FontSize="13"
Foreground="{StaticResource TextPrimary}"/>
<ComboBox Grid.Column="1"
x:Name="FormatCombo"
SelectionChanged="FormatCombo_SelectionChanged">
<ComboBoxItem Tag="onepkg" IsSelected="True">
OneNote Package (.onepkg) – Recommended, best quality
</ComboBoxItem>
<ComboBoxItem Tag="xps">
XPS Document (.xps) – Good layout preservation
</ComboBoxItem>
<ComboBoxItem Tag="pdf">
PDF Document (.pdf) – Universal, lower quality
</ComboBoxItem>
<ComboBoxItem x:Name="LocalBackupItem" Tag="localbackup">
Local Backup Copy – Fast, direct file copy
</ComboBoxItem>
</ComboBox>
</Grid>
<!-- Backup warning banner -->
<Border x:Name="BackupWarning"
Background="{StaticResource WarningBg}"
BorderBrush="{StaticResource WarningBorder}"
BorderThickness="1"
CornerRadius="4"
Padding="10,7"
Margin="0,0,0,10"
Visibility="Collapsed">
<TextBlock Text="⚠ Local backup copies ALL notebooks (selection will be ignored)"
Foreground="{StaticResource WarningFg}"
FontSize="12"/>
</Border>
<!-- Export + Cancel buttons -->
<Grid Margin="0,0,0,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
x:Name="ExportButton"
Content="Export Selected"
Style="{StaticResource PrimaryButtonStyle}"
IsEnabled="False"
Margin="0,0,8,0"
Click="ExportButton_Click"/>
<Button Grid.Column="1"
x:Name="CancelButton"
Content="❌ Cancel"
Style="{StaticResource DangerButtonStyle}"
Visibility="Collapsed"
Click="CancelButton_Click"/>
</Grid>
<!-- Progress bar (indeterminate, shown during export) -->
<ProgressBar x:Name="ExportProgressBar"
Height="4"
IsIndeterminate="True"
Margin="0,0,0,6"
Visibility="Collapsed"
Foreground="{StaticResource ButtonBlue}"
Background="#E9ECEF"/>
<!-- Progress text -->
<Border x:Name="ProgressArea"
Background="{StaticResource InfoBg}"
BorderBrush="{StaticResource InfoBorder}"
BorderThickness="1"
CornerRadius="4"
Padding="10,7"
Margin="0,0,0,6"
Visibility="Collapsed">
<TextBlock x:Name="ProgressText"
Foreground="{StaticResource InfoFg}"
FontSize="12"
TextWrapping="Wrap"/>
</Border>
<!-- Final status message -->
<Border x:Name="StatusBorder"
CornerRadius="4"
Padding="10,8"
Visibility="Collapsed">
<TextBlock x:Name="StatusText"
FontSize="13"
TextWrapping="Wrap"
xml:space="preserve"/>
</Border>
</StackPanel>
</Border>
</Grid>
</Window>