markus / FinalService / KCOM_FinalService / FinalPDFClient / MainWindow.xaml.cs @ ab590000
이력 | 보기 | 이력해설 | 다운로드 (2.71 KB)
1 | 077fb153 | taeseongkim | using KCOMDataModel.DataModel; |
---|---|---|---|
2 | using MarkupToPDF; |
||
3 | using System; |
||
4 | 8e6884a5 | taeseongkim | 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 | 077fb153 | taeseongkim | |
30 | public void MergedPDF() |
||
31 | { |
||
32 | MarkupToPDF.MarkupToPDF markupToPDF = new MarkupToPDF.MarkupToPDF(); |
||
33 | |||
34 | EventHandler<MakeFinalErrorArgs> errorEventHandler = null; |
||
35 | EventHandler<EndFinalEventArgs> endFinalEventHandler = null; |
||
36 | ab590000 | taeseongkim | EventHandler<StatusChangedEventArgs> StatusChangedEventHandler = null; |
37 | 077fb153 | taeseongkim | |
38 | errorEventHandler = (snd, evt) => |
||
39 | { |
||
40 | System.Diagnostics.Debug.WriteLine(evt.Message); |
||
41 | |||
42 | markupToPDF.FinalMakeError -= errorEventHandler; |
||
43 | markupToPDF.EndFinal -= endFinalEventHandler; |
||
44 | ab590000 | taeseongkim | markupToPDF.StatusChanged -= StatusChangedEventHandler; |
45 | 077fb153 | taeseongkim | }; |
46 | |||
47 | endFinalEventHandler = (snd, evt) => |
||
48 | { |
||
49 | ab590000 | taeseongkim | txtOutput.Text += evt.FinalPDFPath + " " + evt.Error; |
50 | 077fb153 | taeseongkim | System.Diagnostics.Debug.WriteLine(evt.Message); |
51 | |||
52 | markupToPDF.FinalMakeError -= errorEventHandler; |
||
53 | markupToPDF.EndFinal -= endFinalEventHandler; |
||
54 | ab590000 | taeseongkim | 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 | 077fb153 | taeseongkim | }; |
63 | |||
64 | markupToPDF.FinalMakeError += errorEventHandler; |
||
65 | markupToPDF.EndFinal += endFinalEventHandler; |
||
66 | ab590000 | taeseongkim | markupToPDF.StatusChanged += StatusChangedEventHandler; |
67 | try |
||
68 | { |
||
69 | var addResult = markupToPDF.AddFinalPDF(txtProject.Text, txtDocId.Text, txtUserId.Text); |
||
70 | 077fb153 | taeseongkim | |
71 | ab590000 | taeseongkim | if (addResult.Success) |
72 | { |
||
73 | markupToPDF.MakeFinalPDF((object)addResult.FinalPDF); |
||
74 | } |
||
75 | } |
||
76 | catch (Exception ex) |
||
77 | 077fb153 | taeseongkim | { |
78 | ab590000 | taeseongkim | txtOutput.Text = ex.ToString(); |
79 | 077fb153 | taeseongkim | } |
80 | } |
||
81 | |||
82 | private void Button_Click(object sender, RoutedEventArgs e) |
||
83 | { |
||
84 | MergedPDF(); |
||
85 | } |
||
86 | |||
87 | 8e6884a5 | taeseongkim | } |
88 | } |