markus / FinalService / KCOM_FinalService / FinalPDFClient / MainWindow.xaml.cs @ ab590000
이력 | 보기 | 이력해설 | 다운로드 (2.71 KB)
1 |
using KCOMDataModel.DataModel; |
---|---|
2 |
using MarkupToPDF; |
3 |
using System; |
4 |
using System.Collections.Generic; |
5 |
using System.Linq; |
6 |
using System.Text; |
7 |
using System.Threading.Tasks; |
8 |
using System.Windows; |
9 |
using System.Windows.Controls; |
10 |
using System.Windows.Data; |
11 |
using System.Windows.Documents; |
12 |
using System.Windows.Input; |
13 |
using System.Windows.Media; |
14 |
using System.Windows.Media.Imaging; |
15 |
using System.Windows.Navigation; |
16 |
using System.Windows.Shapes; |
17 |
|
18 |
namespace FinalPDFClient |
19 |
{ |
20 |
/// <summary> |
21 |
/// MainWindow.xaml에 대한 상호 작용 논리 |
22 |
/// </summary> |
23 |
public partial class MainWindow : Window |
24 |
{ |
25 |
public MainWindow() |
26 |
{ |
27 |
InitializeComponent(); |
28 |
} |
29 |
|
30 |
public void MergedPDF() |
31 |
{ |
32 |
MarkupToPDF.MarkupToPDF markupToPDF = new MarkupToPDF.MarkupToPDF(); |
33 |
|
34 |
EventHandler<MakeFinalErrorArgs> errorEventHandler = null; |
35 |
EventHandler<EndFinalEventArgs> endFinalEventHandler = null; |
36 |
EventHandler<StatusChangedEventArgs> StatusChangedEventHandler = null; |
37 |
|
38 |
errorEventHandler = (snd, evt) => |
39 |
{ |
40 |
System.Diagnostics.Debug.WriteLine(evt.Message); |
41 |
|
42 |
markupToPDF.FinalMakeError -= errorEventHandler; |
43 |
markupToPDF.EndFinal -= endFinalEventHandler; |
44 |
markupToPDF.StatusChanged -= StatusChangedEventHandler; |
45 |
}; |
46 |
|
47 |
endFinalEventHandler = (snd, evt) => |
48 |
{ |
49 |
txtOutput.Text += evt.FinalPDFPath + " " + evt.Error; |
50 |
System.Diagnostics.Debug.WriteLine(evt.Message); |
51 |
|
52 |
markupToPDF.FinalMakeError -= errorEventHandler; |
53 |
markupToPDF.EndFinal -= endFinalEventHandler; |
54 |
markupToPDF.StatusChanged -= StatusChangedEventHandler; |
55 |
}; |
56 |
|
57 |
StatusChangedEventHandler = (snd, evt) => |
58 |
{ |
59 |
txtOutput.Dispatcher.Invoke(() => { |
60 |
txtOutput.Text += evt.Message + " " + evt.CurrentPage + " " + evt.Error; |
61 |
}); |
62 |
}; |
63 |
|
64 |
markupToPDF.FinalMakeError += errorEventHandler; |
65 |
markupToPDF.EndFinal += endFinalEventHandler; |
66 |
markupToPDF.StatusChanged += StatusChangedEventHandler; |
67 |
try |
68 |
{ |
69 |
var addResult = markupToPDF.AddFinalPDF(txtProject.Text, txtDocId.Text, txtUserId.Text); |
70 |
|
71 |
if (addResult.Success) |
72 |
{ |
73 |
markupToPDF.MakeFinalPDF((object)addResult.FinalPDF); |
74 |
} |
75 |
} |
76 |
catch (Exception ex) |
77 |
{ |
78 |
txtOutput.Text = ex.ToString(); |
79 |
} |
80 |
} |
81 |
|
82 |
private void Button_Click(object sender, RoutedEventArgs e) |
83 |
{ |
84 |
MergedPDF(); |
85 |
} |
86 |
|
87 |
} |
88 |
} |