Repository navigation
Expand file tree
/
Copy pathRenderedExportWarningWindow.xaml.cs
More file actions
60 lines (49 loc) · 1.88 KB
/
Copy pathRenderedExportWarningWindow.xaml.cs
File metadata and controls
60 lines (49 loc) · 1.88 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
using System.Windows;
namespace OneNoteExporter;
public enum RenderedExportChoice
{
Cancel,
IndividualSections,
OneNotePackage,
WholeNotebook
}
public partial class RenderedExportWarningWindow : Window
{
public RenderedExportChoice Choice { get; private set; } = RenderedExportChoice.Cancel;
public RenderedExportWarningWindow(
string exportFormat,
bool hasSelectedSections)
{
InitializeComponent();
string formatName = exportFormat.Equals("pdf", StringComparison.OrdinalIgnoreCase)
? "PDF"
: "XPS";
TitleText.Text = $"Large {formatName} exports may fail";
ExplanationText.Text =
"This is a limitation of OneNote's export engine. Choose how you want to export:";
WholeNotebookButtonText.Text =
$"Export the whole notebook as one {formatName} file";
if (hasSelectedSections)
{
OneNotePackageButton.IsEnabled = false;
OneNotePackageButtonText.Text =
"OneNote package unavailable with selected sections";
OneNotePackageButton.ToolTip =
"Available when whole notebooks are selected.";
}
}
private void Complete(RenderedExportChoice choice)
{
Choice = choice;
DialogResult = choice != RenderedExportChoice.Cancel;
Close();
}
private void SectionsButton_Click(object sender, RoutedEventArgs e)
=> Complete(RenderedExportChoice.IndividualSections);
private void OneNotePackageButton_Click(object sender, RoutedEventArgs e)
=> Complete(RenderedExportChoice.OneNotePackage);
private void WholeNotebookButton_Click(object sender, RoutedEventArgs e)
=> Complete(RenderedExportChoice.WholeNotebook);
private void CancelButton_Click(object sender, RoutedEventArgs e)
=> Complete(RenderedExportChoice.Cancel);
}