프로젝트

일반

사용자정보

통계
| 개정판:

hytos / ID2.Manager / ID2.Manager.Compare / Main.cs @ 67cfe4dc

이력 | 보기 | 이력해설 | 다운로드 (28 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
        private TcpServer _TcpServer { get; } = TcpServer.Instance;
29

    
30
        protected override CreateParams CreateParams
31
        {
32
            get
33
            {
34
                CreateParams cp = base.CreateParams;
35
                cp.ExStyle |= 0x02000000;
36
                return cp;
37
            }
38
        }
39

    
40
        private readonly Color _SummaryColor = Color.FromArgb(255, 108, 55);
41
        private BindingList<TextInfo> textInfos { get; } = new BindingList<TextInfo>();
42

    
43
        public Main()
44
        {
45
            InitializeComponent();
46
            var verification = new Controls.Verification(this.radProgressBarElement) { Dock = DockStyle.Fill };
47
            verification.OnCompareComplete += this.CompareCompleteHandler; 
48
            this.LayoutValidation.Controls.Add(verification);
49
            this.DockMainTabStrip.Select();
50

    
51
            var appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName);
52

    
53
            if (!Directory.Exists(appDataPath))
54
            {
55
                Directory.CreateDirectory(appDataPath);
56
            }
57

    
58
            #region 테마 설정
59
            this.radMenuItemControlDefault.Click += RadMenuItemTheme_Click;
60
            this.radMenuItemOffice2013Dark.Click += RadMenuItemTheme_Click;
61
            this.radMenuItemTelerikMetro.Click += RadMenuItemTheme_Click;
62
            this.radMenuItemVisualStudio2012Dark.Click += RadMenuItemTheme_Click;
63
            this.radMenuItemVisualStudio2012Light.Click += RadMenuItemTheme_Click;
64
            this.radMenuItemWindows8.Click += RadMenuItemTheme_Click;
65
            #endregion
66

    
67
            this.Initialize();
68
        }
69

    
70
        /// <summary>
71
        /// 비교가 끝나고 나서 Text를 그리드에 표시한다.
72
        /// </summary>
73
        /// <param name="list"></param>
74
        public void CompareCompleteHandler(List<TextInfo> list)
75
        {
76
            textInfos.Clear();
77
            textInfos.AddRange(list);
78
            #region 파일에서 일치하지 않는 텍스트들을 읽는다.
79
            var doc = this.radGridViewDocument.SelectedRows[0].DataBoundItem as Document;
80
            if (doc != null)
81
            {
82
                string ID2DrawingFolder = Program.AutoCADFolder;
83
                string FilePath = System.IO.Path.Combine(ID2DrawingFolder, $"{doc.DocumentNo}.dwg.txt");
84
                if (File.Exists(FilePath))
85
                {
86
                    using (var sr = new StreamReader(FilePath))
87
                    {
88
                        string line;
89
                        while ((line = sr.ReadLine()) != null)
90
                        {
91
                            var tokens = line.Split(',');
92
                            if (tokens.Length == 3)
93
                            {
94
                                double x, y;
95
                                double.TryParse(tokens[0], out x);
96
                                double.TryParse(tokens[1], out y);
97
                                var textinfo = new TextInfo(x, y, tokens[2]);
98
                                var found = this.textInfos.Find(param => param.Equals(textinfo));
99
                                if (found != null) found.Unmatched = true;
100
                            }
101
                        }
102
                    }
103
                }
104
            }
105
            #endregion
106

    
107
            this.radGridViewData.DataSource = list;
108
        }
109

    
110
        /// <summary>
111
        /// 사용자가 선택한 테마를 적용한다.
112
        /// </summary>
113
        /// <param name="sender"></param>
114
        /// <param name="e"></param>
115
        private void RadMenuItemTheme_Click(object sender, EventArgs e)
116
        {
117
            string theme = (sender as RadMenuItem).Text;
118
            if(theme != this.radDropDownButtonElementTheme.Text)
119
            {
120
                this.radDropDownButtonElementTheme.Text = theme;
121
                Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "App", "Theme", theme);
122
                if (!string.IsNullOrEmpty(theme))
123
                {
124
                    Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = theme;
125
                    Program.ThemeName = theme;
126
                }
127
            }
128
        }
129

    
130
        #region Init, Load
131
        private void Initialize()
132
        {
133
            this.ID2ManagerRadRibbonBar.Expanded = false;
134
            this.FormClosing += Main_FormClosing;
135
        }
136

    
137
        /// <summary>
138
        /// TcpServer를 종료한다.
139
        /// </summary>
140
        /// <param name="sender"></param>
141
        /// <param name="e"></param>
142
        private void Main_FormClosing(object sender, FormClosingEventArgs e)
143
        {
144
            _TcpServer.Close();
145
        }
146

    
147
        protected override void OnLoad(EventArgs e)
148
        {
149
            try
150
            {
151
                this.Text = $"ID2.Manager.Compare - V {Application.ProductVersion}";
152

    
153
                #region 테마를 읽어 적용
154
                string theme = Classes.ID2Helper.IniReadValue(Program.IniFilePath, "App", "Theme");
155
                if (!string.IsNullOrEmpty(theme))
156
                {
157
                    Telerik.WinControls.ThemeResolutionService.ApplicationThemeName = theme;
158
                    Program.ThemeName = theme;
159
                }
160
                #endregion
161

    
162
                this.radDropDownButtonElementTheme.Text = Program.ThemeName;
163
                this.radBrowseEditorAutoCADFolder.ValueChanged += RadBrowseEditorAutoCADFolder_ValueChanged;
164
                this.radBrowseEditorAVEVAFolder.ValueChanged += RadBrowseEditorAVEVAFolder_ValueChanged;
165
                this.radGridViewDocument.DataBindingComplete += RadGridViewDocument_DataBindingComplete;
166
                this.radGridViewDocument.ViewRowFormatting += RadGridViewDocument_ViewRowFormatting;
167
                this.radButtonElementCompare.Click += RadButtonElementCompare_Click;
168
                this.radButtonElementConfiguration.Click += RadButtonElementConfiguration_Click;
169

    
170
                this.radButtonElementRefreshCommand.Click += RadButtonElementRefreshCommand_Click;
171

    
172
                Program.AutoCADFolder = Classes.ID2Helper.IniReadValue(Program.IniFilePath, "Path", "AutoCAD Folder");
173
                if (!string.IsNullOrEmpty(Program.AutoCADFolder)) this.radBrowseEditorAutoCADFolder.Value = Program.AutoCADFolder;
174

    
175
                Program.AVEVAPIDFolder = Classes.ID2Helper.IniReadValue(Program.IniFilePath, "Path", "AVEVA P&ID Folder");
176
                if (!string.IsNullOrEmpty(Program.AVEVAPIDFolder)) this.radBrowseEditorAVEVAFolder.Value = Program.AVEVAPIDFolder;
177

    
178
                this.radGridViewDocument.CellDoubleClick += RadGridViewDocument_CellDoubleClick;
179
                this.radGridViewDocument.SelectionChanged += RadGridViewDocument_SelectionChanged;
180
                this.radGridViewData.SelectionChanged += RadGridViewData_SelectionChanged;
181
                this.radGridViewData.DataBindingComplete += RadGridViewData_DataBindingComplete;
182
                this.radGridViewData.ViewRowFormatting += RadGridViewData_ViewRowFormatting;
183
                this.radButtonSave.Click += RadButtonSave_Click;
184
            }
185
            catch (Exception ex)
186
            {
187
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
188
                RadMessageBox.Show("Failed to load project.", Application.ProductName, MessageBoxButtons.OK, RadMessageIcon.Error);
189
            }
190
            finally
191
            {
192
                var verification = this.LayoutValidation.Controls[0] as Controls.Verification;
193
                _TcpServer.OnZoomEvent += verification.ZoomEventHandler;
194
            }
195

    
196
            base.OnLoad(e);
197
        }
198

    
199
        private void RadGridViewData_ViewRowFormatting(object sender, RowFormattingEventArgs e)
200
        {
201
            if (e.RowElement != null && e.RowElement.RowInfo.DataBoundItem is TextInfo textinfo)
202
            {
203
                e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
204
                if (textinfo.Unmatched)
205
                    e.RowElement.ForeColor = Color.Blue;
206
                else if (!textinfo.Found)
207
                    e.RowElement.ForeColor = Color.Magenta;
208
            }
209
        }
210

    
211
        /// <summary>
212
        /// 일치하지 않는 텍스트들을 파일로 저장한다.
213
        /// </summary>
214
        /// <param name="sender"></param>
215
        /// <param name="e"></param>
216
        /// <exception cref="NotImplementedException"></exception>
217
        private void RadButtonSave_Click(object sender, EventArgs e)
218
        {
219
            var doc = this.radGridViewDocument.SelectedRows[0].DataBoundItem as Document;
220
            if (doc != null)
221
            {
222
                string ID2DrawingFolder = Program.AutoCADFolder;
223
                string FilePath = System.IO.Path.Combine(ID2DrawingFolder, $"{doc.DocumentNo}.dwg.txt");
224
                var unmathced = textInfos.Where(x => x.Unmatched).ToList();
225
                using (var sw = new StreamWriter(FilePath))
226
                {
227
                    unmathced.ForEach(x => sw.WriteLine(x.ToString()));
228
                }
229

    
230
                RadMessageBox.Show("불일치 텍스트들을 저장했습니다.");
231
            }
232
        }
233

    
234
        /// <summary>
235
        /// 칼럼 길이를 데이터에 맞춘다.
236
        /// </summary>
237
        /// <param name="sender"></param>
238
        /// <param name="e"></param>
239
        private void RadGridViewData_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
240
        {
241
            this.radGridViewData.BestFitColumns(BestFitColumnMode.AllCells);
242
        }
243

    
244
        /// <summary>
245
        /// 선택한 Text를 그래픽 화면에서 Zoom한다.
246
        /// </summary>
247
        /// <param name="sender"></param>
248
        /// <param name="e"></param>
249
        private void RadGridViewData_SelectionChanged(object sender, EventArgs e)
250
        {
251
            if ((sender as RadGridView).CurrentRow != null)
252
            {
253
                var TextInfo = (sender as RadGridView).CurrentRow.DataBoundItem as TextInfo;
254
                if (TextInfo != null)
255
                {
256
                    var verification = this.LayoutValidation.Controls[0] as Controls.Verification;
257
                    TextInfo.Found = verification.Zoom(TextInfo);
258
                }
259
            }
260
        }
261

    
262
        /// <summary>
263
        /// 문서를 더블 클릭했을때 문서를 비교한다.
264
        /// </summary>
265
        /// <param name="sender"></param>
266
        /// <param name="e"></param>
267
        private void RadGridViewDocument_CellDoubleClick(object sender, GridViewCellEventArgs e)
268
        {
269
            if (this.radGridViewDocument.SelectedRows.Any() && this.radGridViewDocument.SelectedRows[0].Equals(e.Row))
270
            {
271
                this.Cursor = Cursors.WaitCursor;
272
                try
273
                {
274
                    var doc = this.radGridViewDocument.SelectedRows[0].DataBoundItem as Document;
275

    
276
                    var verification = this.LayoutValidation.Controls[0] as Controls.Verification;
277
                    verification.CompareDrawings(new List<Document>() { doc });
278
                }
279
                finally
280
                {
281
                    this.Cursor = Cursors.Default;
282
                }
283
            }
284
        }
285

    
286
        private void RadGridViewDocument_SelectionChanged(object sender, EventArgs e)
287
        {
288
            if (this.radGridViewDocument.SelectedRows.Any() && this.radGridViewDocument.SelectedRows[0].DataBoundItem is Document doc)
289
            {
290
                this.Cursor = Cursors.WaitCursor;
291
                try
292
                {
293
                    var verification = this.LayoutValidation.Controls[0] as Controls.Verification;
294
                    verification.CompareDrawings(new List<Document>() { doc });
295
                }
296
                finally
297
                {
298
                    this.Cursor = Cursors.Default;
299
                }
300
            }
301
        }
302

    
303
        /// <summary>
304
        /// 도면 리스트를 갱신한다.
305
        /// </summary>
306
        /// <param name="sender"></param>
307
        /// <param name="e"></param>
308
        private void RadButtonElementRefreshCommand_Click(object sender, EventArgs e)
309
        {
310
            try
311
            {
312
                this.Cursor = Cursors.WaitCursor;
313

    
314
                var AutoCADFiles = Directory.GetFiles(Program.AutoCADFolder, "*.dwg");
315
                var AVEVAFiles = Directory.GetFiles(Program.AVEVAPIDFolder, "*.dwg");
316

    
317
                MakeDocumentList(AutoCADFiles, AVEVAFiles);
318
            }
319
            finally
320
            {
321
                this.Cursor = Cursors.Default;
322
            }
323
        }
324

    
325
        /// <summary>
326
        /// 환경 설정 창을 띄운다.
327
        /// </summary>
328
        /// <param name="sender"></param>
329
        /// <param name="e"></param>
330
        private void RadButtonElementConfiguration_Click(object sender, EventArgs e)
331
        {
332
            using (var frm = new Forms.ExceptLayer())
333
            {
334
                if (DialogResult.OK == frm.ShowDialog(this))
335
                {
336
                    string ExceptLayers = string.Join(",", Forms.ExceptLayer.ExceptLayers.Select(x => x.Name));
337
                    Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Except Layers", ExceptLayers);
338

    
339
                    string ExceptLayersVisible = string.Join(",", Forms.ExceptLayer.ExceptLayers.Select(x => x.Visible));
340
                    Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Except Layers Visible", ExceptLayersVisible);
341

    
342
                    string LineLayers = string.Join(",", Forms.ExceptLayer.LineLayers.Select(x => x.Name));
343
                    Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Line Layers", LineLayers);
344

    
345
                    Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Length Tolerance Ratio", 
346
                        Forms.ExceptLayer.LengthToleranceRatio.ToString());
347

    
348
                    Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "Arrow Max Length",
349
                        Forms.ExceptLayer.ArrowMaxLength.ToString());
350

    
351
                    string SpecialCharacters = string.Join(",", Forms.ExceptLayer.SpecialCharacters.Select(x => $"{x.Special}={x.Normal}"));
352
                    Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Verification", "SpecialCharacters", SpecialCharacters);
353
                }
354
            }
355
        }
356

    
357
        private void RadButtonElementCompare_Click(object sender, EventArgs e)
358
        {
359
            try
360
            {
361
                this.Cursor = Cursors.WaitCursor;
362

    
363
                var docs = this.radGridViewDocument.Rows.Where(x => (x.DataBoundItem is Document doc) && doc.Checked).
364
                    Select(x => (x.DataBoundItem as Document)).ToList();
365
                var verification = this.LayoutValidation.Controls[0] as Controls.Verification;
366
                verification.CompareDrawings(docs, true);
367
            }
368
            finally
369
            {
370
                this.Cursor = Cursors.Default;
371
            }
372
        }
373

    
374
        private void RadGridViewDocument_ViewRowFormatting(object sender, RowFormattingEventArgs e)
375
        {
376
            if(e.RowElement is GridRowElement)
377
            {
378
                if (e.RowElement.RowInfo.DataBoundItem is Document doc)
379
                {
380
                    if (!doc.IsValid)
381
                    {
382
                        e.RowElement.ForeColor = Color.Gray;
383
                        e.RowElement.Font = Program.UnmatchedFont;
384
                    }
385
                    else
386
                    {
387
                        e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
388
                        e.RowElement.Font = Program.MatchedFont;
389
                    }
390
                }
391
            }
392
            else
393
            {
394
                e.RowElement.ResetValue(LightVisualElement.ForeColorProperty, ValueResetFlags.Local);
395
                e.RowElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
396
            }
397
        }
398

    
399
        private void RadGridViewDocument_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
400
        {
401
            radGridViewDocument.BestFitColumns();
402
        }
403

    
404
        private void RadBrowseEditorAVEVAFolder_ValueChanged(object sender, EventArgs e)
405
        {
406
            if(Directory.Exists(this.radBrowseEditorAVEVAFolder.Value))
407
            {
408
                Program.AVEVAPIDFolder = this.radBrowseEditorAVEVAFolder.Value;
409
                Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Path", "AVEVA P&ID Folder", Program.AVEVAPIDFolder);
410

    
411
                var AVEVAFiles = Directory.GetFiles(Program.AVEVAPIDFolder, "*.dwg");
412

    
413
                var AutoCADFiles = new List<string>();
414
                if (Directory.Exists(this.radBrowseEditorAutoCADFolder.Value))
415
                {
416
                    AutoCADFiles.AddRange(Directory.GetFiles(this.radBrowseEditorAutoCADFolder.Value, "*.dwg"));
417
                }
418

    
419
                MakeDocumentList(AutoCADFiles, AVEVAFiles);
420
            }
421
        }
422

    
423
        private void RadBrowseEditorAutoCADFolder_ValueChanged(object sender, EventArgs e)
424
        {
425
            if (Directory.Exists(this.radBrowseEditorAutoCADFolder.Value))
426
            {
427
                Program.AutoCADFolder = this.radBrowseEditorAutoCADFolder.Value;
428
                Classes.ID2Helper.IniWriteValue(Program.IniFilePath, "Path", "AutoCAD Folder", Program.AutoCADFolder);
429

    
430
                var AutoCADFiles = Directory.GetFiles(Program.AutoCADFolder, "*.dwg");
431

    
432
                var AVEVAFiles = new List<string>();
433
                if (Directory.Exists(this.radBrowseEditorAVEVAFolder.Value))
434
                {
435
                    AVEVAFiles.AddRange(Directory.GetFiles(this.radBrowseEditorAVEVAFolder.Value, "*.dwg"));
436
                }
437

    
438
                MakeDocumentList(AutoCADFiles, AVEVAFiles);
439
            }
440
        }
441

    
442
        private void MakeDocumentList(IList<string> AutoCADFiles, IList<string> AVEVAFiles)
443
        {
444
            radGridViewDocument.DataSource = null;
445

    
446
            Program.Documents.Clear();
447
            AutoCADFiles.ForAll(x => Program.Documents.Add(new Document(Path.GetFileNameWithoutExtension(x).ToUpper()) { AutoCADFileName = Path.GetFileNameWithoutExtension(x).ToUpper()}));
448

    
449
            var addings = new List<Document>();
450
            foreach(var file in AVEVAFiles)
451
            {
452
                string FileName = Path.GetFileNameWithoutExtension(file).ToUpper();
453
                var doc = Program.Documents.Find(x => x.AutoCADFileName == FileName);
454
                if(doc != null)
455
                {
456
                    doc.AVEVAFileName = FileName;
457
                }
458
                else
459
                {
460
                    addings.Add(new Document(FileName) { AVEVAFileName = FileName });
461
                }
462
            }
463

    
464
            addings.ForAll(x => Program.Documents.Add(x));
465

    
466
            radGridViewDocument.DataSource = Program.Documents;
467
        }
468
        #endregion
469

    
470
        private void RadDropDownList_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
471
        {
472
            if (sender is RadDropDownList ddl)
473
            {
474
                if (ddl.SelectedValue != null)
475
                {
476
                    if (string.IsNullOrEmpty(ddl.SelectedValue.ToString()))
477
                    {
478
                        ddl.BackColor = Color.White;
479
                        ddl.ForeColor = Color.Black;
480
                        ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular);
481
                    }
482
                    else
483
                    {
484
                        ddl.BackColor = Color.DarkSlateBlue;
485
                        ddl.ForeColor = Color.Yellow;
486
                        ddl.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold);
487
                    }
488
                }
489
            }
490
        }
491

    
492
        private void RadTextBoxDocumentNo_KeyUp(object sender, KeyEventArgs e)
493
        {
494
            if (sender is RadTextBox txtBox)
495
            {
496
                if (txtBox.Text.Length > 0)
497
                {
498
                    txtBox.BackColor = Color.DarkSlateBlue;
499
                    txtBox.ForeColor = Color.Yellow;
500
                    txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Bold);
501
                }
502
                else
503
                {
504
                    txtBox.BackColor = Color.White;
505
                    txtBox.ForeColor = Color.Black;
506
                    txtBox.Font = new Font("Segoe UI", 8.25F, FontStyle.Regular);
507
                }
508
            }
509
        }
510

    
511
        /*
512
        private void GetCheckedList()
513
        {
514
            RadGridView grid = this.radGridViewDocuments;
515

    
516
            //var checkers = grid.Rows.Where(x =>
517
            //{
518
            //    return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value);
519
            //}).Select(x => x.DataBoundItem as Documents).ToList();
520

    
521
            //var viewRows = new Queue<GridViewRowInfo>(this.radGridViewDocuments.MasterTemplate.DataView.Where(x => x.Cells["spq");
522
            var viewRows = grid.MasterTemplate.DataView;
523

    
524
            var checkers = viewRows.Where(x =>
525
            {
526
                return x.Cells["Checked"].Value != null && Convert.ToBoolean(x.Cells["Checked"].Value);
527
            }).ToList();
528

    
529
            var rows = new GridViewDataRowInfo[checkers.Count];
530
            checkers.CopyTo(rows, 0);
531

    
532
            if (rows.Length > 0)
533
            {
534
                grid.BeginUpdate();
535

    
536
                int nLoop = 0;
537
                rows.ForAll(x =>
538
                {
539
                    grid.Rows.Remove(rows[nLoop]);
540
                    nLoop++;
541
                });
542

    
543
                grid.EndUpdate();
544
            }
545

    
546

    
547
            //grid.Rows.re grid.Rows.ToList().Intersect(checkers)
548

    
549

    
550
            //RadMessageBox.Show($"{checkers.Count()}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
551
            //RadMessageBox.Show($"{this.documents.Count}", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
552
            this.lbSelectAndTotal.Text = $"{grid.MasterTemplate.DataView.Count} / {this.TotalCount} (Selected / Total)";
553
        }
554
        */
555

    
556
        #region ColumnGroup
557
        private void InitColumnGroupsViewDefinition(RadGridView gridView)
558
        {
559
            ColumnGroupsViewDefinition columnGroupsView = new ColumnGroupsViewDefinition();
560

    
561
            List<string> chkColNames = new List<string>() { "Checked" };
562

    
563
            List<string> docLinkColNames = new List<string>() { "AutoCADLink", "ID2Connection", "PDFLink", "MarkupLink", "AVEVALink", "Compare" };
564
            List<string> docInfoColNames = new List<string>() { "RefProjectCode", "System", "SubSystemCode", "DocumentNo", "PersonInCharge", "Worker", "AVEVAPersonInCharge", "AVEVAWorker", "JobLevel", "RevisonNo" };
565
            List<string> rvToColNames = new List<string>() { "ToIsDiscussion", "ToRemarks", "ToCreator", "ToCapture" };
566
            List<string> rvFrColNames = new List<string>() { "FrReviewStatus", "FrRemarks", "FrCreator", "FrCapture" };
567
            List<string> wkID2ColNames = new List<string>() { "ID2StartDate", "ID2EndDate", "ID2Status", "ID2Issues", "ID2Capture", "ReplyModifications", "ReplyRequester" };
568
            List<string> wkAVEVAColNames = new List<string>() { "IsConvert", "AVEVAConvertDate", "AVEVAWorkDate", "AVEVAStatus", "AVEVAIssues" };
569
            List<string> valProdColNames = new List<string>() { "AVEVAReviewDate", "ProdReviewer", "ProdIsResult", "ProdRemarks" };
570
            List<string> valCntColNames = new List<string>() { "ClientReviewer", "ClientIsResult", "ClientRemarks" };
571
            List<string> dtColNames = new List<string>() { "DTIsGateWay", "DTIsImport", "DTIsRegSystem", "DTRemarks" };
572

    
573
            //체크
574
            GridViewColumnGroup chkColGrp = new GridViewColumnGroup("√") { IsPinned = true };
575
            GridViewColumnGroupRow chkColGrpRow = new GridViewColumnGroupRow();
576
            chkColGrpRow.ColumnNames.AddRange(chkColNames);
577
            chkColGrp.Rows.Add(chkColGrpRow);
578

    
579
            //도면
580
            GridViewColumnGroup docColGrp = new GridViewColumnGroup("도면 ");
581
            GridViewColumnGroup docLinkColGrp = new GridViewColumnGroup("프로그램 연동");
582
            GridViewColumnGroup docInfoColGrp = new GridViewColumnGroup("도면정보");
583

    
584
            GridViewColumnGroupRow docLinkColGrpRow = new GridViewColumnGroupRow();
585
            docLinkColGrpRow.ColumnNames.AddRange(docLinkColNames);
586

    
587
            GridViewColumnGroupRow docInfoColGrpRow = new GridViewColumnGroupRow();
588
            docInfoColGrpRow.ColumnNames.AddRange(docInfoColNames);
589

    
590
            docLinkColGrp.Rows.Add(docLinkColGrpRow);
591
            docColGrp.Groups.Add(docLinkColGrp);
592
            docInfoColGrp.Rows.Add(docInfoColGrpRow);
593
            docColGrp.Groups.Add(docInfoColGrp);
594

    
595
            //검토
596
            GridViewColumnGroup rvColGrp = new GridViewColumnGroup("검토", "review");
597
            GridViewColumnGroup rvToColGrp = new GridViewColumnGroup("도프텍");
598
            GridViewColumnGroup rvFrColGrp = new GridViewColumnGroup("삼성");
599

    
600
            GridViewColumnGroupRow rvToColGrpRow = new GridViewColumnGroupRow();
601
            rvToColGrpRow.ColumnNames.AddRange(rvToColNames);
602

    
603
            GridViewColumnGroupRow rvFrColGrpRow = new GridViewColumnGroupRow();
604
            rvFrColGrpRow.ColumnNames.AddRange(rvFrColNames);
605

    
606
            rvToColGrp.Rows.Add(rvToColGrpRow);
607
            rvFrColGrp.Rows.Add(rvFrColGrpRow);
608

    
609
            rvColGrp.Groups.Add(rvToColGrp);
610
            rvColGrp.Groups.Add(rvFrColGrp);
611

    
612
            //작업
613
            GridViewColumnGroup wkColGrp = new GridViewColumnGroup("작업", "work");
614
            GridViewColumnGroup wkID2ColGrp = new GridViewColumnGroup("ID2");
615
            GridViewColumnGroup wkAVEVAColGrp = new GridViewColumnGroup("AVEVA");
616

    
617
            GridViewColumnGroupRow wkID2ColGrpRow = new GridViewColumnGroupRow();
618
            wkID2ColGrpRow.ColumnNames.AddRange(wkID2ColNames);
619

    
620
            GridViewColumnGroupRow wkAVEVAColGrpRow = new GridViewColumnGroupRow();
621
            wkAVEVAColGrpRow.ColumnNames.AddRange(wkAVEVAColNames);
622

    
623
            wkID2ColGrp.Rows.Add(wkID2ColGrpRow);
624
            wkAVEVAColGrp.Rows.Add(wkAVEVAColGrpRow);
625

    
626
            wkColGrp.Groups.Add(wkID2ColGrp);
627
            wkColGrp.Groups.Add(wkAVEVAColGrp);
628

    
629
            //Validation
630
            GridViewColumnGroup valColGrp = new GridViewColumnGroup("Validation", "validation");
631
            GridViewColumnGroup valProdColGrp = new GridViewColumnGroup("도프텍");
632
            GridViewColumnGroup valCntColGrp = new GridViewColumnGroup("삼성전자");
633

    
634
            GridViewColumnGroupRow valProdColGrpRow = new GridViewColumnGroupRow();
635
            valProdColGrpRow.ColumnNames.AddRange(valProdColNames);
636

    
637
            GridViewColumnGroupRow valCntColGrpRow = new GridViewColumnGroupRow();
638
            valCntColGrpRow.ColumnNames.AddRange(valCntColNames);
639

    
640
            valProdColGrp.Rows.Add(valProdColGrpRow);
641
            valCntColGrp.Rows.Add(valCntColGrpRow);
642

    
643
            valColGrp.Groups.Add(valProdColGrp);
644
            valColGrp.Groups.Add(valCntColGrp);
645

    
646
            //AVEVA Net
647
            GridViewColumnGroup dtColGrp = new GridViewColumnGroup("AVEVA Net\n(Digital Twin)", "avevanet");
648

    
649
            GridViewColumnGroupRow dtColGrpRow = new GridViewColumnGroupRow();
650
            dtColGrpRow.ColumnNames.AddRange(dtColNames);
651

    
652
            dtColGrp.Rows.Add(dtColGrpRow);
653

    
654
            //Group 추가
655
            columnGroupsView.ColumnGroups.Add(chkColGrp);
656
            columnGroupsView.ColumnGroups.Add(docColGrp);
657
            columnGroupsView.ColumnGroups.Add(wkColGrp);
658
            columnGroupsView.ColumnGroups.Add(rvColGrp);
659
            columnGroupsView.ColumnGroups.Add(valColGrp);
660
            columnGroupsView.ColumnGroups.Add(dtColGrp);
661

    
662
            gridView.MasterTemplate.ViewDefinition = columnGroupsView;
663
        }
664
        #endregion
665
    }
666
}
667

    
668
public class FilterColumn
669
{
670
    public string Name { get; set; }
671
    public string FieldName { get; set; }
672
    public bool IsSelect { get; set; }
673
}
클립보드 이미지 추가 (최대 크기: 500 MB)