hytos / ID2.Manager / ID2.Manager.Compare / Main.cs @ 42d7b127
이력 | 보기 | 이력해설 | 다운로드 (27.2 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel; |
4 |
using System.Data; |
5 |
using System.Drawing; |
6 |
using System.Linq; |
7 |
using System.Text; |
8 |
using System.Threading.Tasks; |
9 |
using System.Windows.Forms; |
10 |
|
11 |
using System.IO; |
12 |
using System.Reflection; |
13 |
using System.Diagnostics; |
14 |
|
15 |
using ID2.Manager.Controls; |
16 |
using ID2.Manager.Classes; |
17 |
|
18 |
using Telerik.WinControls; |
19 |
using Telerik.WinControls.UI; |
20 |
using Telerik.Windows.Diagrams.Core; |
21 |
using Xtractor.Viewer; |
22 |
using devDept.Eyeshot; |
23 |
|
24 |
namespace ID2.Manager |
25 |
{ |
26 |
public partial class Main : RadRibbonForm |
27 |
{ |
28 |
protected override CreateParams CreateParams |
29 |
{ |
30 |
get |
31 |
{ |
32 |
CreateParams cp = base.CreateParams; |
33 |
cp.ExStyle |= 0x02000000; |
34 |
return cp; |
35 |
} |
36 |
} |
37 |
|
38 |
private readonly Color _SummaryColor = Color.FromArgb(255, 108, 55); |
39 |
private BindingList<TextInfo> textInfos { get; } = new BindingList<TextInfo>(); |
40 |
|
41 |
public Main() |
42 |
{ |
43 |
InitializeComponent(); |
44 |
var verification = new Controls.Verification(this.radProgressBarElement) { Dock = DockStyle.Fill }; |
45 |
verification.OnCompareComplete += this.CompareCompleteHandler; |
46 |
this.LayoutValidation.Controls.Add(verification); |
47 |
this.DockMainTabStrip.Select(); |
48 |
|
49 |
var appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName); |
50 |
|
51 |
if (!Directory.Exists(appDataPath)) |
52 |
{ |
53 |
Directory.CreateDirectory(appDataPath); |
54 |
} |
55 |
|
56 |
#region 테마 설정 |
57 |
this.radMenuItemControlDefault.Click += RadMenuItemTheme_Click; |
58 |
this.radMenuItemOffice2013Dark.Click += RadMenuItemTheme_Click; |
59 |
this.radMenuItemTelerikMetro.Click += RadMenuItemTheme_Click; |
60 |
this.radMenuItemVisualStudio2012Dark.Click += RadMenuItemTheme_Click; |
61 |
this.radMenuItemVisualStudio2012Light.Click += RadMenuItemTheme_Click; |
62 |
this.radMenuItemWindows8.Click += RadMenuItemTheme_Click; |
63 |
#endregion |
64 |
|
65 |
this.Initialize(); |
66 |
} |
67 |
|
68 |
/// <summary> |
69 |
/// 비교가 끝나고 나서 Text를 그리드에 표시한다. |
70 |
/// </summary> |
71 |
/// <param name="list"></param> |
72 |
public void CompareCompleteHandler(List<TextInfo> list) |
73 |
{ |
74 |
textInfos.Clear(); |
75 |
textInfos.AddRange(list); |
76 |
#region 파일에서 일치하지 않는 텍스트들을 읽는다. |
77 |
var doc = this.radGridViewDocument.SelectedRows[0].DataBoundItem as Document; |
78 |
if (doc != null) |
79 |
{ |
80 |
string ID2DrawingFolder = Program.AutoCADFolder; |
81 |
string FilePath = System.IO.Path.Combine(ID2DrawingFolder, $"{doc.DocumentNo}.dwg.txt"); |
82 |
if (File.Exists(FilePath)) |
83 |
{ |
84 |
using (var sr = new StreamReader(FilePath)) |
85 |
{ |
86 |
string line; |
87 |
while ((line = sr.ReadLine()) != null) |
88 |
{ |
89 |
var tokens = line.Split(','); |
90 |
if (tokens.Length == 3) |
91 |
{ |
92 |
double x, y; |
93 |
double.TryParse(tokens[0], out x); |
94 |
double.TryParse(tokens[1], out y); |
95 |
var textinfo = new TextInfo(x, y, tokens[2]); |
96 |
var found = this.textInfos.Find(param => param.Equals(textinfo)); |
97 |
if (found != null) found.Unmatched = true; |
98 |
} |
99 |
} |
100 |
} |
101 |
} |
102 |
} |
103 |
#endregion |
104 |
|
105 |
this.radGridViewData.DataSource = list; |
106 |
} |
107 |
|
108 |
/// <summary> |
109 |
/// 사용자가 선택한 테마를 적용한다. |
110 |
/// </summary> |
111 |
/// <param name="sender"></param> |
112 |
/// <param name="e"></param> |
113 |
private void RadMenuItemTheme_Click(object sender, EventArgs e) |
114 |
{ |
115 |
string theme = (sender as RadMenuItem).Text; |
116 |
if(theme != this.radDropDownButtonElementTheme.Text) |
117 |
{ |
118 |
this.radDropDownButtonElementTheme.Text = theme; |
119 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "App", "Theme", theme); |
120 |
if (!string.IsNullOrEmpty(theme)) |
121 |
{ |
122 |
Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = theme; |
123 |
Program.ThemeName = theme; |
124 |
} |
125 |
} |
126 |
} |
127 |
|
128 |
#region Init, Load |
129 |
private void Initialize() |
130 |
{ |
131 |
this.ID2ManagerRadRibbonBar.Expanded = false; |
132 |
} |
133 |
|
134 |
protected override void OnLoad(EventArgs e) |
135 |
{ |
136 |
try |
137 |
{ |
138 |
this.Text = $"ID2.Manager.Compare - V {Application.ProductVersion}"; |
139 |
|
140 |
#region 테마를 읽어 적용 |
141 |
string theme = Classes.ID2Helper.IniReadValue(Program.IniFilePath, "App", "Theme"); |
142 |
if (!string.IsNullOrEmpty(theme)) |
143 |
{ |
144 |
Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = theme; |
145 |
Program.ThemeName = theme; |
146 |
} |
147 |
#endregion |
148 |
|
149 |
this.radDropDownButtonElementTheme.Text = Program.ThemeName; |
150 |
this.radBrowseEditorAutoCADFolder.ValueChanged += RadBrowseEditorAutoCADFolder_ValueChanged; |
151 |
this.radBrowseEditorAVEVAFolder.ValueChanged += RadBrowseEditorAVEVAFolder_ValueChanged; |
152 |
this.radGridViewDocument.DataBindingComplete += RadGridViewDocument_DataBindingComplete; |
153 |
this.radGridViewDocument.ViewRowFormatting += RadGridViewDocument_ViewRowFormatting; |
154 |
this.radButtonElementCompare.Click += RadButtonElementCompare_Click; |
155 |
this.radButtonElementConfiguration.Click += RadButtonElementConfiguration_Click; |
156 |
|
157 |
this.radButtonElementRefreshCommand.Click += RadButtonElementRefreshCommand_Click; |
158 |
|
159 |
Program.AutoCADFolder = Classes.ID2Helper.IniReadValue(Program.IniFilePath, "Path", "AutoCAD Folder"); |
160 |
if (!string.IsNullOrEmpty(Program.AutoCADFolder)) this.radBrowseEditorAutoCADFolder.Value = Program.AutoCADFolder; |
161 |
|
162 |
Program.AVEVAPIDFolder = Classes.ID2Helper.IniReadValue(Program.IniFilePath, "Path", "AVEVA P&ID Folder"); |
163 |
if (!string.IsNullOrEmpty(Program.AVEVAPIDFolder)) this.radBrowseEditorAVEVAFolder.Value = Program.AVEVAPIDFolder; |
164 |
|
165 |
this.radGridViewDocument.CellClick += RadGridViewDocument_CellClick; |
166 |
this.radGridViewDocument.SelectionChanged += RadGridViewDocument_SelectionChanged; |
167 |
this.radGridViewData.SelectionChanged += RadGridViewData_SelectionChanged; |
168 |
this.radGridViewData.DataBindingComplete += RadGridViewData_DataBindingComplete; |
169 |
this.radGridViewData.ViewRowFormatting += RadGridViewData_ViewRowFormatting; |
170 |
this.radButtonSave.Click += RadButtonSave_Click; |
171 |
} |
172 |
catch (Exception ex) |
173 |
{ |
174 |
Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex); |
175 |
RadMessageBox.Show("Failed to load project.", Application.ProductName, MessageBoxButtons.OK, RadMessageIcon.Error); |
176 |
} |
177 |
|
178 |
base.OnLoad(e); |
179 |
} |
180 |
|
181 |
private void RadGridViewData_ViewRowFormatting(object sender, RowFormattingEventArgs e) |
182 |
{ |
183 |
if (e.RowElement != null && e.RowElement.RowInfo.DataBoundItem is TextInfo textinfo) |
184 |
{ |
185 |
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local); |
186 |
if (textinfo.Unmatched) |
187 |
e.RowElement.ForeColor = Color.Blue; |
188 |
else if (!textinfo.Found) |
189 |
e.RowElement.ForeColor = Color.Magenta; |
190 |
} |
191 |
} |
192 |
|
193 |
/// <summary> |
194 |
/// 일치하지 않는 텍스트들을 파일로 저장한다. |
195 |
/// </summary> |
196 |
/// <param name="sender"></param> |
197 |
/// <param name="e"></param> |
198 |
/// <exception cref="NotImplementedException"></exception> |
199 |
private void RadButtonSave_Click(object sender, EventArgs e) |
200 |
{ |
201 |
var doc = this.radGridViewDocument.SelectedRows[0].DataBoundItem as Document; |
202 |
if (doc != null) |
203 |
{ |
204 |
string ID2DrawingFolder = Program.AutoCADFolder; |
205 |
string FilePath = System.IO.Path.Combine(ID2DrawingFolder, $"{doc.DocumentNo}.dwg.txt"); |
206 |
var unmathced = textInfos.Where(x => x.Unmatched).ToList(); |
207 |
using (var sw = new StreamWriter(FilePath)) |
208 |
{ |
209 |
unmathced.ForEach(x => sw.WriteLine(x.ToString())); |
210 |
} |
211 |
|
212 |
RadMessageBox.Show("불일치 텍스트들을 저장했습니다."); |
213 |
} |
214 |
} |
215 |
|
216 |
/// <summary> |
217 |
/// 칼럼 길이를 데이터에 맞춘다. |
218 |
/// </summary> |
219 |
/// <param name="sender"></param> |
220 |
/// <param name="e"></param> |
221 |
private void RadGridViewData_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e) |
222 |
{ |
223 |
this.radGridViewData.BestFitColumns(BestFitColumnMode.AllCells); |
224 |
} |
225 |
|
226 |
/// <summary> |
227 |
/// 선택한 Text를 그래픽 화면에서 Zoom한다. |
228 |
/// </summary> |
229 |
/// <param name="sender"></param> |
230 |
/// <param name="e"></param> |
231 |
private void RadGridViewData_SelectionChanged(object sender, EventArgs e) |
232 |
{ |
233 |
if ((sender as RadGridView).CurrentRow != null) |
234 |
{ |
235 |
var TextInfo = (sender as RadGridView).CurrentRow.DataBoundItem as TextInfo; |
236 |
if (TextInfo != null) |
237 |
{ |
238 |
var verification = this.LayoutValidation.Controls[0] as Controls.Verification; |
239 |
TextInfo.Found = verification.Zoom(TextInfo); |
240 |
} |
241 |
} |
242 |
} |
243 |
|
244 |
private void RadGridViewDocument_CellClick(object sender, GridViewCellEventArgs e) |
245 |
{ |
246 |
if (this.radGridViewDocument.SelectedRows.Any() && this.radGridViewDocument.SelectedRows[0].Equals(e.Row)) |
247 |
{ |
248 |
this.Cursor = Cursors.WaitCursor; |
249 |
try |
250 |
{ |
251 |
var doc = this.radGridViewDocument.SelectedRows[0].DataBoundItem as Document; |
252 |
|
253 |
var verification = this.LayoutValidation.Controls[0] as Controls.Verification; |
254 |
verification.CompareDrawings(new List<Document>() { doc }); |
255 |
} |
256 |
finally |
257 |
{ |
258 |
this.Cursor = Cursors.Default; |
259 |
} |
260 |
} |
261 |
} |
262 |
|
263 |
private void RadGridViewDocument_SelectionChanged(object sender, EventArgs e) |
264 |
{ |
265 |
if (this.radGridViewDocument.SelectedRows.Any() && this.radGridViewDocument.SelectedRows[0].DataBoundItem is Document doc) |
266 |
{ |
267 |
this.Cursor = Cursors.WaitCursor; |
268 |
try |
269 |
{ |
270 |
var verification = this.LayoutValidation.Controls[0] as Controls.Verification; |
271 |
verification.CompareDrawings(new List<Document>() { doc }); |
272 |
} |
273 |
finally |
274 |
{ |
275 |
this.Cursor = Cursors.Default; |
276 |
} |
277 |
} |
278 |
} |
279 |
|
280 |
/// <summary> |
281 |
/// 도면 리스트를 갱신한다. |
282 |
/// </summary> |
283 |
/// <param name="sender"></param> |
284 |
/// <param name="e"></param> |
285 |
private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e) |
286 |
{ |
287 |
try |
288 |
{ |
289 |
this.Cursor = Cursors.WaitCursor; |
290 |
|
291 |
var AutoCADFiles = Directory.GetFiles(Program.AutoCADFolder, "*.dwg"); |
292 |
var AVEVAFiles = Directory.GetFiles(Program.AVEVAPIDFolder, "*.dwg"); |
293 |
|
294 |
MakeDocumentList(AutoCADFiles, AVEVAFiles); |
295 |
} |
296 |
finally |
297 |
{ |
298 |
this.Cursor = Cursors.Default; |
299 |
} |
300 |
} |
301 |
|
302 |
/// <summary> |
303 |
/// 환경 설정 창을 띄운다. |
304 |
/// </summary> |
305 |
/// <param name="sender"></param> |
306 |
/// <param name="e"></param> |
307 |
private void RadButtonElementConfiguration_Click(object sender, EventArgs e) |
308 |
{ |
309 |
using (var frm = new Forms.ExceptLayer()) |
310 |
{ |
311 |
if (DialogResult.OK == frm.ShowDialog(this)) |
312 |
{ |
313 |
string ExceptLayers = string.Join(",", Forms.ExceptLayer.ExceptLayers.Select(x => x.Name)); |
314 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Except Layers", ExceptLayers); |
315 |
|
316 |
string ExceptLayersVisible = string.Join(",", Forms.ExceptLayer.ExceptLayers.Select(x => x.Visible)); |
317 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Except Layers Visible", ExceptLayersVisible); |
318 |
|
319 |
string LineLayers = string.Join(",", Forms.ExceptLayer.LineLayers.Select(x => x.Name)); |
320 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Line Layers", LineLayers); |
321 |
|
322 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Length Tolerance Ratio", |
323 |
Forms.ExceptLayer.LengthToleranceRatio.ToString()); |
324 |
|
325 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Arrow Max Length", |
326 |
Forms.ExceptLayer.ArrowMaxLength.ToString()); |
327 |
|
328 |
string SpecialCharacters = string.Join(",", Forms.ExceptLayer.SpecialCharacters.Select(x => $"{x.Special}={x.Normal}")); |
329 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "SpecialCharacters", SpecialCharacters); |
330 |
} |
331 |
} |
332 |
} |
333 |
|
334 |
private void RadButtonElementCompare_Click(object sender, EventArgs e) |
335 |
{ |
336 |
try |
337 |
{ |
338 |
this.Cursor = Cursors.WaitCursor; |
339 |
|
340 |
var docs = this.radGridViewDocument.Rows.Where(x => (x.DataBoundItem is Document doc) && doc.Checked). |
341 |
Select(x => (x.DataBoundItem as Document)).ToList(); |
342 |
var verification = this.LayoutValidation.Controls[0] as Controls.Verification; |
343 |
verification.CompareDrawings(docs, true); |
344 |
} |
345 |
finally |
346 |
{ |
347 |
this.Cursor = Cursors.Default; |
348 |
} |
349 |
} |
350 |
|
351 |
private void RadGridViewDocument_ViewRowFormatting(object sender, RowFormattingEventArgs e) |
352 |
{ |
353 |
if(e.RowElement is GridRowElement) |
354 |
{ |
355 |
if (e.RowElement.RowInfo.DataBoundItem is Document doc) |
356 |
{ |
357 |
if (!doc.IsValid) |
358 |
{ |
359 |
e.RowElement.ForeColor = Color.Gray; |
360 |
e.RowElement.Font = Program.UnmatchedFont; |
361 |
} |
362 |
else |
363 |
{ |
364 |
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local); |
365 |
e.RowElement.Font = Program.MatchedFont; |
366 |
} |
367 |
} |
368 |
} |
369 |
else |
370 |
{ |
371 |
e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local); |
372 |
e.RowElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local); |
373 |
} |
374 |
} |
375 |
|
376 |
private void RadGridViewDocument_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e) |
377 |
{ |
378 |
radGridViewDocument.BestFitColumns(); |
379 |
} |
380 |
|
381 |
private void RadBrowseEditorAVEVAFolder_ValueChanged(object sender, EventArgs e) |
382 |
{ |
383 |
if(Directory.Exists(this.radBrowseEditorAVEVAFolder.Value)) |
384 |
{ |
385 |
Program.AVEVAPIDFolder = this.radBrowseEditorAVEVAFolder.Value; |
386 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Path", "AVEVA P&ID Folder", Program.AVEVAPIDFolder); |
387 |
|
388 |
var AVEVAFiles = Directory.GetFiles(Program.AVEVAPIDFolder, "*.dwg"); |
389 |
|
390 |
var AutoCADFiles = new List<string>(); |
391 |
if (Directory.Exists(this.radBrowseEditorAutoCADFolder.Value)) |
392 |
{ |
393 |
AutoCADFiles.AddRange(Directory.GetFiles(this.radBrowseEditorAutoCADFolder.Value, "*.dwg")); |
394 |
} |
395 |
|
396 |
MakeDocumentList(AutoCADFiles, AVEVAFiles); |
397 |
} |
398 |
} |
399 |
|
400 |
private void RadBrowseEditorAutoCADFolder_ValueChanged(object sender, EventArgs e) |
401 |
{ |
402 |
if (Directory.Exists(this.radBrowseEditorAutoCADFolder.Value)) |
403 |
{ |
404 |
Program.AutoCADFolder = this.radBrowseEditorAutoCADFolder.Value; |
405 |
Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Path", "AutoCAD Folder", Program.AutoCADFolder); |
406 |
|
407 |
var AutoCADFiles = Directory.GetFiles(Program.AutoCADFolder, "*.dwg"); |
408 |
|
409 |
var AVEVAFiles = new List<string>(); |
410 |
if (Directory.Exists(this.radBrowseEditorAVEVAFolder.Value)) |
411 |
{ |
412 |
AVEVAFiles.AddRange(Directory.GetFiles(this.radBrowseEditorAVEVAFolder.Value, "*.dwg")); |
413 |
} |
414 |
|
415 |
MakeDocumentList(AutoCADFiles, AVEVAFiles); |
416 |
} |
417 |
} |
418 |
|
419 |
private void MakeDocumentList(IList<string> AutoCADFiles, IList<string> AVEVAFiles) |
420 |
{ |
421 |
radGridViewDocument.DataSource = null; |
422 |
|
423 |
Program.Documents.Clear(); |
424 |
AutoCADFiles.ForAll(x => Program.Documents.Add(new Document(Path.GetFileNameWithoutExtension(x).ToUpper()) { AutoCADFileName = Path.GetFileNameWithoutExtension(x).ToUpper()})); |
425 |
|
426 |
var addings = new List<Document>(); |
427 |
foreach(var file in AVEVAFiles) |
428 |
{ |
429 |
string FileName = Path.GetFileNameWithoutExtension(file).ToUpper(); |
430 |
var doc = Program.Documents.Find(x => x.AutoCADFileName == FileName); |
431 |
if(doc != null) |
432 |
{ |
433 |
doc.AVEVAFileName = FileName; |
434 |
} |
435 |
else |
436 |
{ |
437 |
addings.Add(new Document(FileName) { AVEVAFileName = FileName }); |
438 |
} |
439 |
} |
440 |
|
441 |
addings.ForAll(x => Program.Documents.Add(x)); |
442 |
|
443 |
radGridViewDocument.DataSource = Program.Documents; |
444 |
} |
445 |
#endregion |
446 |
|
447 |
private void RadDropDownList_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e) |
448 |
{ |
449 |
if (sender is RadDropDownList ddl) |
450 |
{ |
451 |
if (ddl.SelectedValue != null) |
452 |
{ |
453 |
if (string.IsNullOrEmpty(ddl.SelectedValue.ToString())) |
454 |
{ |
455 |
ddl.BackColor = Color.White; |
456 |
ddl.ForeColor = Color.Black; |
457 |
ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular); |
458 |
} |
459 |
else |
460 |
{ |
461 |
ddl.BackColor = Color.DarkSlateBlue; |
462 |
ddl.ForeColor = Color.Yellow; |
463 |
ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold); |
464 |
} |
465 |
} |
466 |
} |
467 |
} |
468 |
|
469 |
private void RadTextBoxDocumentNo_KeyUp(object sender, KeyEventArgs e) |
470 |
{ |
471 |
if (sender is RadTextBox txtBox) |
472 |
{ |
473 |
if (txtBox.Text.Length > 0) |
474 |
{ |
475 |
txtBox.BackColor = Color.DarkSlateBlue; |
476 |
txtBox.ForeColor = Color.Yellow; |
477 |
txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold); |
478 |
} |
479 |
else |
480 |
{ |
481 |
txtBox.BackColor = Color.White; |
482 |
txtBox.ForeColor = Color.Black; |
483 |
txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular); |
484 |
} |
485 |
} |
486 |
} |
487 |
|
488 |
/* |
489 |
private void GetCheckedList() |
490 |
{ |
491 |
RadGridView grid = this.radGridViewDocuments; |
492 |
|
493 |
//var checkers = grid.Rows.Where(x => |
494 |
//{ |
495 |
// return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value); |
496 |
//}).Select(x => x.DataBoundItem as Documents).ToList(); |
497 |
|
498 |
//var viewRows = new Queue<GridViewRowInfo>(this.radGridViewDocuments.MasterTemplate.DataView.Where(x => x.Cells["spq"); |
499 |
var viewRows = grid.MasterTemplate.DataView; |
500 |
|
501 |
var checkers = viewRows.Where(x => |
502 |
{ |
503 |
return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value); |
504 |
}).ToList(); |
505 |
|
506 |
var rows = new GridViewDataRowInfo[checkers.Count]; |
507 |
checkers.CopyTo(rows, 0); |
508 |
|
509 |
if (rows.Length > 0) |
510 |
{ |
511 |
grid.BeginUpdate(); |
512 |
|
513 |
int nLoop = 0; |
514 |
rows.ForAll(x => |
515 |
{ |
516 |
grid.Rows.Remove(rows[nLoop]); |
517 |
nLoop++; |
518 |
}); |
519 |
|
520 |
grid.EndUpdate(); |
521 |
} |
522 |
|
523 |
|
524 |
//grid.Rows.re grid.Rows.ToList().Intersect(checkers) |
525 |
|
526 |
|
527 |
//RadMessageBox.Show($"{checkers.Count()}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
528 |
//RadMessageBox.Show($"{this.documents.Count}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info); |
529 |
this.lbSelectAndTotal.Text = $"{grid.MasterTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)"; |
530 |
} |
531 |
*/ |
532 |
|
533 |
#region ColumnGroup |
534 |
private void InitColumnGroupsViewDefinition(RadGridView gridView) |
535 |
{ |
536 |
ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition(); |
537 |
|
538 |
List<string> chkColNames = new List<string>() { "Checked" }; |
539 |
|
540 |
List<string> docLinkColNames = new List<string>() { "AutoCADLink", "ID2Connection", "PDFLink", "MarkupLink", "AVEVALink", "Compare" }; |
541 |
List<string> docInfoColNames = new List<string>() { "RefProjectCode", "System", "SubSystemCode", "DocumentNo", "PersonInCharge", "Worker", "AVEVAPersonInCharge", "AVEVAWorker", "JobLevel", "RevisonNo" }; |
542 |
List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture" }; |
543 |
List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" }; |
544 |
List<string> wkID2ColNames = new List<string>() { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester" }; |
545 |
List<string> wkAVEVAColNames = new List<string>() { "IsConvert", "AVEVAConvertDate", "AVEVAWorkDate", "AVEVAStatus", "AVEVAIssues" }; |
546 |
List<string> valProdColNames = new List<string>() { "AVEVAReviewDate", "ProdReviewer", "ProdIsResult", "ProdRemarks" }; |
547 |
List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" }; |
548 |
List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" }; |
549 |
|
550 |
//체크 |
551 |
GridViewColumnGroup chkColGrp = new GridViewColumnGroup("√") { IsPinned = true }; |
552 |
GridViewColumnGroupRow chkColGrpRow = new GridViewColumnGroupRow(); |
553 |
chkColGrpRow.ColumnNames.AddRange(chkColNames); |
554 |
chkColGrp.Rows.Add(chkColGrpRow); |
555 |
|
556 |
//도면 |
557 |
GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면 "); |
558 |
GridViewColumnGroup docLinkColGrp = new GridViewColumnGroup("프로그램 연동"); |
559 |
GridViewColumnGroup docInfoColGrp = new GridViewColumnGroup("도면정보"); |
560 |
|
561 |
GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow(); |
562 |
docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames); |
563 |
|
564 |
GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow(); |
565 |
docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames); |
566 |
|
567 |
docLinkColGrp.Rows.Add(docLinkColGrpRow); |
568 |
docColGrp.Groups.Add(docLinkColGrp); |
569 |
docInfoColGrp.Rows.Add(docInfoColGrpRow); |
570 |
docColGrp.Groups.Add(docInfoColGrp); |
571 |
|
572 |
//검토 |
573 |
GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review"); |
574 |
GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍"); |
575 |
GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성"); |
576 |
|
577 |
GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow(); |
578 |
rvToColGrpRow.ColumnNames.AddRange(rvToColNames); |
579 |
|
580 |
GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow(); |
581 |
rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames); |
582 |
|
583 |
rvToColGrp.Rows.Add(rvToColGrpRow); |
584 |
rvFrColGrp.Rows.Add(rvFrColGrpRow); |
585 |
|
586 |
rvColGrp.Groups.Add(rvToColGrp); |
587 |
rvColGrp.Groups.Add(rvFrColGrp); |
588 |
|
589 |
//작업 |
590 |
GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work"); |
591 |
GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2"); |
592 |
GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA"); |
593 |
|
594 |
GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow(); |
595 |
wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames); |
596 |
|
597 |
GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow(); |
598 |
wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames); |
599 |
|
600 |
wkID2ColGrp.Rows.Add(wkID2ColGrpRow); |
601 |
wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow); |
602 |
|
603 |
wkColGrp.Groups.Add(wkID2ColGrp); |
604 |
wkColGrp.Groups.Add(wkAVEVAColGrp); |
605 |
|
606 |
//Validation |
607 |
GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation"); |
608 |
GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍"); |
609 |
GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자"); |
610 |
|
611 |
GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow(); |
612 |
valProdColGrpRow.ColumnNames.AddRange(valProdColNames); |
613 |
|
614 |
GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow(); |
615 |
valCntColGrpRow.ColumnNames.AddRange(valCntColNames); |
616 |
|
617 |
valProdColGrp.Rows.Add(valProdColGrpRow); |
618 |
valCntColGrp.Rows.Add(valCntColGrpRow); |
619 |
|
620 |
valColGrp.Groups.Add(valProdColGrp); |
621 |
valColGrp.Groups.Add(valCntColGrp); |
622 |
|
623 |
//AVEVA Net |
624 |
GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet"); |
625 |
|
626 |
GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow(); |
627 |
dtColGrpRow.ColumnNames.AddRange(dtColNames); |
628 |
|
629 |
dtColGrp.Rows.Add(dtColGrpRow); |
630 |
|
631 |
//Group 추가 |
632 |
columnGroupsView.ColumnGroups.Add(chkColGrp); |
633 |
columnGroupsView.ColumnGroups.Add(docColGrp); |
634 |
columnGroupsView.ColumnGroups.Add(wkColGrp); |
635 |
columnGroupsView.ColumnGroups.Add(rvColGrp); |
636 |
columnGroupsView.ColumnGroups.Add(valColGrp); |
637 |
columnGroupsView.ColumnGroups.Add(dtColGrp); |
638 |
|
639 |
gridView.MasterTemplate.ViewDefinition = columnGroupsView; |
640 |
} |
641 |
#endregion |
642 |
} |
643 |
} |
644 |
|
645 |
public class FilterColumn |
646 |
{ |
647 |
public string Name { get; set; } |
648 |
public string FieldName { get; set; } |
649 |
public bool IsSelect { get; set; } |
650 |
} |