개정판 29aa5251
Feature: PDF 보기 기능 추가
Change-Id: Id05e9545b71d7e2a911e302aceeecff612201667
ID2.Manager/ID2.Manager/Main.cs | ||
---|---|---|
43 | 43 |
{ |
44 | 44 |
InitializeComponent(); |
45 | 45 |
|
46 |
|
|
47 | 46 |
//Telerik.WinControls.RadControlSpy.RadControlSpyForm radControlSpyForm = new Telerik.WinControls.RadControlSpy.RadControlSpyForm(); |
48 | 47 |
//radControlSpyForm.Show(); |
49 | 48 |
|
... | ... | |
63 | 62 |
this.radButtonSearch.Click += RadButtonSearch_Click; |
64 | 63 |
this.radButtonID2.Click += RadButtonID2_Click; |
65 | 64 |
|
65 |
this.radGridViewDocuments.SelectionChanged += RadGridViewDocuments_SelectionChanged; |
|
66 | 66 |
this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting; |
67 | 67 |
this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit; |
68 | 68 |
this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick; |
... | ... | |
87 | 87 |
this.Initialize(); |
88 | 88 |
} |
89 | 89 |
|
90 |
/// <summary> |
|
91 |
/// 선택된 행의 AutoCAD와 PDF 파일을 보여준다. |
|
92 |
/// </summary> |
|
93 |
/// <param name="sender"></param> |
|
94 |
/// <param name="e"></param> |
|
95 |
private void RadGridViewDocuments_SelectionChanged(object sender, EventArgs e) |
|
96 |
{ |
|
97 |
void ShowAutoCADFile(string FilePath) |
|
98 |
{ |
|
99 |
Controls.AutoCADViewer viewer = null; |
|
100 |
foreach (var control in this.radSplitContainerViewer.SplitPanels[0].Controls) |
|
101 |
{ |
|
102 |
if (control is Controls.AutoCADViewer _viewer) |
|
103 |
{ |
|
104 |
viewer = _viewer; |
|
105 |
break; |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
if (viewer == null) |
|
110 |
{ |
|
111 |
viewer = new Controls.AutoCADViewer() { Dock = DockStyle.Fill }; |
|
112 |
this.radSplitContainerViewer.SplitPanels[0].Controls.Add(viewer); |
|
113 |
} |
|
114 |
else |
|
115 |
{ |
|
116 |
viewer.Visible = true; |
|
117 |
} |
|
118 |
|
|
119 |
if (File.Exists(FilePath) && viewer != null) viewer.ReadDWG(FilePath); |
|
120 |
} |
|
121 |
|
|
122 |
void ShowPDFFile(string FilePath) |
|
123 |
{ |
|
124 |
Controls.PDFViewer viewer = null; |
|
125 |
foreach (var control in this.radSplitContainerViewer.SplitPanels[1].Controls) |
|
126 |
{ |
|
127 |
if (control is Controls.PDFViewer _viewer) |
|
128 |
{ |
|
129 |
viewer = _viewer; |
|
130 |
break; |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
if (viewer == null) |
|
135 |
{ |
|
136 |
viewer = new Controls.PDFViewer() { Dock = DockStyle.Fill }; |
|
137 |
this.radSplitContainerViewer.SplitPanels[1].Controls.Add(viewer); |
|
138 |
} |
|
139 |
else |
|
140 |
{ |
|
141 |
viewer.Visible = true; |
|
142 |
} |
|
143 |
|
|
144 |
if (File.Exists(FilePath) && viewer != null) viewer.ReadPDF(FilePath); |
|
145 |
} |
|
146 |
|
|
147 |
Documents doc = this.radGridViewDocuments.SelectedRows.First().DataBoundItem as Documents; |
|
148 |
{ |
|
149 |
string extension = ".dwg"; |
|
150 |
string filePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", "Native", $"{doc.DocumentNo}{extension}"); |
|
151 |
ShowAutoCADFile(filePath); |
|
152 |
} |
|
153 |
|
|
154 |
{ |
|
155 |
string extension = ".pdf"; |
|
156 |
string filePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", $"{doc.DocumentNo}{extension}"); |
|
157 |
ShowPDFFile(filePath); |
|
158 |
} |
|
159 |
} |
|
160 |
|
|
90 | 161 |
#region Init, Load |
91 | 162 |
private void Initialize() |
92 | 163 |
{ |
... | ... | |
606 | 677 |
|
607 | 678 |
switch (e.Column.Name) |
608 | 679 |
{ |
609 |
case "AutoCADLink": |
|
610 |
{ |
|
611 |
Controls.AutoCADViewer viewer = null; |
|
612 |
foreach (var control in this.radSplitContainerViewer.SplitPanels[0].Controls) |
|
613 |
{ |
|
614 |
if (control is Controls.AutoCADViewer _viewer) |
|
615 |
{ |
|
616 |
viewer = _viewer; |
|
617 |
break; |
|
618 |
} |
|
619 |
} |
|
620 |
|
|
621 |
if (viewer == null) |
|
622 |
{ |
|
623 |
viewer = new Controls.AutoCADViewer() { Dock = DockStyle.Fill }; |
|
624 |
this.radSplitContainerViewer.SplitPanels[0].Controls.Add(viewer); |
|
625 |
} |
|
626 |
else |
|
627 |
{ |
|
628 |
viewer.Visible = true; |
|
629 |
} |
|
630 |
|
|
631 |
if (e.Row.DataBoundItem is Documents doc) |
|
632 |
{ |
|
633 |
extension = "dwg"; |
|
634 |
string filePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", "Native", $"{doc.DocumentNo}.{extension}"); |
|
635 |
|
|
636 |
if (File.Exists(filePath) && viewer != null) viewer.ReadDWG(filePath); |
|
637 |
} |
|
638 |
} |
|
639 |
break; |
|
640 |
case "PDFLink": |
|
641 |
Controls.PDFViewer pdfviewer = null; |
|
642 |
foreach (var control in this.radSplitContainerViewer.SplitPanels[1].Controls) |
|
643 |
{ |
|
644 |
if (control is Controls.PDFViewer _viewer) |
|
645 |
{ |
|
646 |
pdfviewer = _viewer; |
|
647 |
break; |
|
648 |
} |
|
649 |
} |
|
650 |
|
|
651 |
if (pdfviewer == null) |
|
652 |
{ |
|
653 |
pdfviewer = new Controls.PDFViewer() { Dock = DockStyle.Fill }; |
|
654 |
this.radSplitContainerViewer.SplitPanels[1].Controls.Add(pdfviewer); |
|
655 |
} |
|
656 |
else |
|
657 |
{ |
|
658 |
pdfviewer.Visible = true; |
|
659 |
} |
|
660 |
|
|
661 |
break; |
|
662 | 680 |
case "MarkupLink": |
663 | 681 |
{ |
664 | 682 |
if (e.Row.DataBoundItem is Documents doc) |
내보내기 Unified diff