프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Services / BaseServices.cs @ 5c64268e

이력 | 보기 | 이력해설 | 다운로드 (49.4 KB)

1
using Microsoft.AspNet.SignalR.Client;
2
using IKCOM;
3
using KCOM.Common;
4
using KCOM.ServiceDeepView;
5
using KCOMDataModel.DataModel;
6
using Newtonsoft.Json;
7
using System;
8
using System.Collections.Generic;
9
using System.Collections.ObjectModel;
10
using System.ComponentModel;
11
using System.Linq;
12
using System.Runtime.CompilerServices;
13
using System.Text;
14
using System.Windows;
15
using System.Windows.Controls;
16
using Telerik.Windows.Controls;
17
using MarkupToPDF.Controls.Parsing;
18
using Telerik.Windows.Data;
19
using System.Web;
20

    
21
namespace KCOM.Views
22
{
23
    public partial class MainMenu : UserControl, INotifyPropertyChanged
24
    {
25
        //const string DeepZoomUrl = @"http://{baseUrl}/TileSource/{TileSourcePath}/{ItemsPath}/{SharepointItemID}/{PageNo}.jpg";
26
        public ServiceDeepViewClient BaseClient;
27
        public KcomService.ServiceDeepViewClient BaseTaskClient
28
        {
29
            get {return new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint); }
30
        }
31

    
32
        public ViewInfo _ViewInfo;
33
        public DOCINFO _DocInfo;
34
        public DOCUMENT_ITEM _DocItem;
35
        public MEMBER userData;
36
        public List<int> MarkupSortList = new List<int>();
37

    
38
        public event PropertyChangedEventHandler PropertyChanged;
39
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
40
        {
41
            if (PropertyChanged != null)
42
            {
43
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
44
            }
45
        }
46

    
47
        private Common.DocumentSet _CurrentDoc { get; set; }
48
        public Common.DocumentSet CurrentDoc
49
        {
50
            get
51
            {
52
                return _CurrentDoc;
53
            }
54
            set
55
            {
56
                if (value != CurrentDoc)
57
                {
58
                    _CurrentDoc = value;
59
                    NotifyPropertyChanged();
60
                }
61
            }
62
        }
63
        public void ServiceOn()
64
        {
65
            //BaseTaskClient = new KcomService.ServiceDeepViewClient(App._binding, App._EndPoint);
66
            BaseClient = new ServiceDeepViewClient(App._binding, App._EndPoint);
67

    
68
            BaseClient.GetDocInfoCompleted += BaseClient_GetDocInfoCompleted; //문서 섬네일, 페이지크기, 마크업 정보 [3]
69
            BaseClient.GetConversionStateCompleted += BaseClient_GetConversionStateCompleted;  //컨버팅의 여부 [2] 
70
            BaseClient.GetSystemDataCompleted += BaseClient_GetSystemDataCompleted; //시스템 정보 [1] 
71
            BaseClient.GetDocumentItemInfoCompleted += BaseClient_GetDocumentItemInfoCompleted; // 문서 자체의 정보 [4]
72
            BaseClient.GetMarkupInfoItemsCompleted += BaseClient_GetMarkupInfoItemsCompleted;
73
            BaseClient.GetDeptDataCompleted += BaseClient_GetDeptDataCompleted;
74
            BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted;
75
            BaseClient.GetVPRevisionHistoryCompleted += BaseClient_GetVPRevisionHistoryCompleted;
76
            BaseClient.SetFinalPDFCompleted += BaseClient_SetFinalPDFCompleted;
77
            BaseClient.GetCompareRectCompleted += BaseClient_GetCompareRectCompleted;
78
            BaseClient.DeleteMarkupCompleted += BaseClient_DeleteMarkupCompleted;
79
            BaseClient.DelFavoriteVPCompleted += BaseClient_DelFavoriteVPCompleted;
80
            BaseClient.EditFavoriteVPCompleted += BaseClient_EditFavoriteVPCompleted;
81
        }
82

    
83

    
84

    
85
        private void BaseClient_EditFavoriteVPCompleted(object sender, EditFavoriteVPCompletedEventArgs e)
86
        {
87
            //Logger.sendResLog("EditFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
88
            
89
            if (e.Error == null && e.Result != false)
90
            {
91
                //Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
92
                BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
93
            }
94
            else
95
            {
96
                DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning");
97
            }
98
        }
99

    
100
        private void BaseClient_DelFavoriteVPCompleted(object sender, DelFavoriteVPCompletedEventArgs e)
101
        {
102
            //Logger.sendResLog("DelFavoriteVPCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
103

    
104
            if (e.Error == null && e.Result != false)
105
            {
106
                //Logger.sendReqLog("GetFavoriteVPAsync", App.ViewInfo.ProjectNO + "," + App.ViewInfo.UserID + "," + App.ViewInfo.DocumentItemID, 1);
107
                BaseClient.GetFavoriteVPAsync(App.ViewInfo.ProjectNO, App.ViewInfo.UserID, App.ViewInfo.DocumentItemID);
108
            }
109
            else
110
            {
111
                DialogMessage_Alert("Unable to delete the file due to a system failure", "Warning");
112
            }
113
        }
114

    
115
        /// <summary>
116
        /// Compare 결과를 받아 화면에 표시한다
117
        /// </summary>
118
        /// <param name="sender"></param>
119
        /// <param name="e"></param>
120
        private void BaseClient_GetCompareRectCompleted(object sender, GetCompareRectCompletedEventArgs e)
121
        {
122
            if (e.Error != null || e.Result == null)
123
            {
124
                if (e.Error != null)
125
                {
126
                    DialogMessage_Alert(e.Error.ToString(), "Error");
127
                }
128
                else
129
                {
130
                    DialogMessage_Alert("Compare 기능을 원활히 실행하기 위한 데이터가 부족합니다", "안내");
131
                }
132
            }
133
            else
134
            {
135
                e.Result.ForEach(d =>
136
                {
137
                    d.Width = d.Width;
138
                    d.Height = d.Height;
139
                    var point = MarkupToPDF.Controls.Common.MathSet.getRectMiddlePoint(d);
140
                    System.Windows.Shapes.Rectangle myEllipse = new System.Windows.Shapes.Rectangle();
141
                    myEllipse.Fill = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 33, 215, 119));
142
                    myEllipse.Opacity = 1;
143
                    myEllipse.Width = d.Width;
144
                    myEllipse.Height = d.Height;
145
                    Canvas.SetLeft(myEllipse, d.X - ((point.X - d.X) / 2.0));
146
                    Canvas.SetTop(myEllipse, d.Y - ((point.Y - d.Y) / 2.0));
147
                    myEllipse.RenderTransformOrigin = point;
148
                    canvas_compareBorder.Children.Add(myEllipse);
149
                });
150
                canvas_compareBorder.Visibility = Visibility.Visible;
151
                da.From = 1;
152
                da.To = 0.5;
153
                da.Duration = new Duration(TimeSpan.FromSeconds(1));
154
                da.AutoReverse = true;
155
                canvas_compareBorder.BeginAnimation(OpacityProperty, da);
156
            }
157
        }
158

    
159
        private void BaseClient_SetFinalPDFCompleted(object sender, SetFinalPDFCompletedEventArgs e)
160
        {
161
            //Logger.sendResLog("SetFinalPDFCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
162
            string errormsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFError", "MSG", "최종 파일을 만드는데 문제가 발생하였습니다");
163
            string successmsg = CommonLib.Common.GetAlertMessageString("SetFinalPDFSuccess", "MSG", "최종 파일 생성 중입니다. 문서관리시스템을 확인해주세요");
164
            if (e.Error != null || e.Result.Status == FinalStatus.Error)
165
            {
166
                DialogMessage_Alert(errormsg, "안내");
167
            }
168
            else
169
            {
170
                DialogMessage_Alert(successmsg, "안내");
171
            }
172
        }
173

    
174
        private void BaseClient_GetVPRevisionHistoryCompleted(object sender, GetVPRevisionHistoryCompletedEventArgs e)
175
        {
176
            //Logger.sendResLog("GetVPRevisionHistoryCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
177

    
178
            if (e.Result != null && e.Error == null)
179
            {
180
                List<VPRevision> list = e.Result;
181
                foreach (var item in list)
182
                {
183

    
184
                    if (App.isExternal)
185
                    {
186
                        var sBaseServiceURL = CommonLib.Common.GetConfigString("ExternalOriginalFileUrl", "URL", "", App.isExternal);
187

    
188
                        if (!string.IsNullOrWhiteSpace(item.TO_VENDOR))
189
                        {
190
                            var toUri = new Uri(HttpUtility.UrlDecode(item.TO_VENDOR));
191
                            item.TO_VENDOR = $"{sBaseServiceURL}{toUri.LocalPath}";
192
                        }
193

    
194
                        if (!string.IsNullOrWhiteSpace(item.FROM_VENDOR))
195
                        {
196
                            var fromUri = new Uri(HttpUtility.UrlDecode(item.FROM_VENDOR));
197
                            item.FROM_VENDOR = $"{sBaseServiceURL}{fromUri.LocalPath}";
198
                        }
199
                    }
200
                    else
201
                    {
202

    
203
                        item.FROM_VENDOR = HttpUtility.UrlDecode(item.FROM_VENDOR);
204
                    }
205
                }
206

    
207
                gridViewHistory.ItemsSource = list.OrderByDescending(x=>x.RevNo);
208
            }
209
            //TempFile.TempLoad();
210
        }
211

    
212
        private void BaseClient_DeleteMarkupCompleted(object sender, DeleteMarkupCompletedEventArgs e)
213
        {
214
            //Logger.sendResLog("DeleteMarkupCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
215

    
216
            foreach(var info in ViewerDataModel.Instance._markupInfoList)
217
            {
218
                if(info.UserID == App.ViewInfo.UserID)
219
                {
220
                    info.userDelete = true;
221
                    info.DisplayColor = "#FFFF0000";
222
                }
223
                else
224
                {
225
                    info.userDelete = false;
226
                }
227
            }
228
        }
229

    
230
        private void BaseClient_GetDeptDataCompleted(object sender, GetDeptDataCompletedEventArgs e)
231
        {
232
            if (e.Error == null)
233
            {
234
                //Logger.sendResLog("GetDeptDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
235
            }
236
            else
237
            {
238
                //Logger.sendResLog("GetDeptDataCompleted",  "\r Error :" + e.Error, 1);
239
            }
240

    
241
            if (e.Result != null)
242
            {
243
                e.Result.Sort();
244
                //cbSymbolPublic.ItemsSource = e.Result.ToList();
245
            }
246
        }
247

    
248
        public MarkupInfoItem PreviewUserMarkupInfoItem { get; set; }
249

    
250
        /// <summary>
251
        /// 문서 정보를 가져온다
252
        /// </summary>
253
        /// <param name="sender"></param>
254
        /// <param name="e"></param>
255
        private async void BaseClient_GetDocInfoCompleted(object sender, GetDocInfoCompletedEventArgs e)
256
        {
257
            ////Logger.sendResLog("GetDocInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
258

    
259
            if (e.Error != null)
260
            {
261
                DialogMessage_Alert("The page cannot be displayed.", "Alert");
262
            }
263
            else if (e.Result == null)
264
            {
265
                DialogMessage_Alert("Document information is missing.", "Alert");
266
            }
267
            else
268
            {
269
                string sFolder = _ViewInfo.DocumentItemID.All(char.IsDigit) ? (Convert.ToUInt32(_ViewInfo.DocumentItemID) / 100).ToString() : (_ViewInfo.DocumentItemID.Length >= 5 ? _ViewInfo.DocumentItemID.Substring(0, 5) : _ViewInfo.DocumentItemID);
270
                var MainUrl = string.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal).Replace("png", "jpg"), _ViewInfo.ProjectNO, sFolder, _ViewInfo.DocumentItemID, "{PageNo}");
271
                _DocInfo = e.Result;
272
                _DocInfo.ORIGINAL_FILE = HttpUtility.UrlDecode(_DocInfo.ORIGINAL_FILE);
273
                foreach (var item in _DocInfo.DOCPAGE.OrderBy(order => order.PAGE_NUMBER))
274
                {
275
                    ViewerDataModel.Instance.Document_Info.Add(item);
276
                }
277
                //Logger.sendReqLog("GetMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID, 1);
278
                CurrentDoc = new Common.DocumentSet
279
                {
280
                    docInfo = _DocInfo,
281
                    Document_Id = _DocInfo.DOCUMENT_ID,
282
                    File_Original = _DocInfo.ORIGINAL_FILE,
283

    
284
                    Document_NO = _DocItem?.DOCUMENT_NO,
285
                    File_Result = _DocItem?.RESULT_FILE,
286
                    Group_No = _DocItem?.GROUP_NO,
287
                    ProjectNo = _DocItem?.PROJECT_NO,
288
                    Revision = _DocItem?.REVISION,
289
                };
290

    
291
                var instanceMain = this.ParentOfType<MainWindow>();
292
                string firstpage = "1";
293
                string lastpage = _DocInfo.PAGE_COUNT.ToString();
294
                instanceMain.dzTopMenu.tlcurrentPage.Text = firstpage;
295
                instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = lastpage;
296
                App.MarkusVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
297

    
298
                string apptitle = string.Format("MARKUS(ver.{2}) - {0}(Rev.{1})", _DocItem?.DOCUMENT_NO, _DocItem?.REVISION, App.MarkusVersion);
299

    
300
                instanceMain.Title = apptitle;
301

    
302
                #region 페이지 이미지를 로컬에 저장
303
                string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName());
304

    
305
                //.Replace("jpg", "png")을 붙이는 이유는 MainUrl에 확장명이 jpg로 설정한 경우가 있기 때문
306

    
307
                #endregion
308

    
309
                App.PageStorage = new PageManager.PageStorage(MainUrl.Replace("jpg", "png"), tempStoragePath, "png", _DocInfo.PAGE_COUNT, 1);
310

    
311
                //App.SamplePageStorage = new PageManager.PageStorage(MainUrl.Replace("png", "jpg"), tempStoragePath, "jpg", _DocInfo.PAGE_COUNT);
312
                await this.pageNavigator.SetPageNaviAsync(CurrentDoc.docInfo.DOCPAGE.ToList(), MainUrl);
313
            }
314
        }
315

    
316
        private void pageNavigator_ThumbInitialized(object sender,EventArgs e)
317
        {
318
            BaseClient.GetMarkupInfoItemsAsync(_ViewInfo.ProjectNO, _DocInfo.ID);
319

    
320
            ViewerDataModel.Instance.MarkupControls_USER.Clear();
321
            //ViewerDataModel.Instance.SystemMain.dzMainMenu.TempLoad();
322

    
323
            /// 기존 임시파일 정리
324
            #region 단어 검색용 파일 다운로드
325

    
326
            DownloadOriginalFile();
327

    
328
            #endregion
329

    
330
            //Logger.sendReqLog("GetVPRevisionHistoryAsync", CurrentDoc.ProjectNo + "," + CurrentDoc.Document_NO + "," + CurrentDoc.Document_Id, 1);
331
            BaseClient.GetVPRevisionHistoryAsync(CurrentDoc.ProjectNo, CurrentDoc.Document_NO, CurrentDoc.Document_Id);
332

    
333
        }
334

    
335

    
336
        /// <summary>
337
        /// get markupinfo and markupitem from database
338
        ///  - 1. called when document is loaded
339
        ///  - 2. called when user do consolidation
340
        /// </summary>
341
        /// <param name="sender"></param>
342
        /// <param name="e"></param>
343
        private void BaseClient_GetMarkupInfoItemsCompleted(object sender, GetMarkupInfoItemsCompletedEventArgs e)
344
        {
345
            //Logger.sendResLog("GetMarkupInfoItemsCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.Count + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
346

    
347
            ViewerDataModel.Instance.MarkupControls_USER.Clear();
348
            ViewerDataModel.Instance.MarkupControls.Clear();
349

    
350
            try
351
            {
352

    
353
                if (e.Result != null)
354
                {
355
                    ViewerDataModel.Instance._markupInfoList.Clear();
356
                    if (e.Result.Count > 0) ViewerDataModel.Instance.MyMarkupList.Clear();
357

    
358
                    foreach (var info in e.Result)
359
                    {
360
                        if (info.Depatment == null) info.Depatment = "Unknown";
361

    
362
                        if (info.UserID == App.ViewInfo.UserID)
363
                        {
364
                            info.userDelete = true;
365
                            info.DisplayColor = "#FFFF0000";
366
                        }
367
                        else
368
                        {
369
                            info.userDelete = false;
370
                        }
371

    
372
                        ViewerDataModel.Instance._markupInfoList.Add(info);
373
                    }
374

    
375
                    var userInfoList = ViewerDataModel.Instance._markupInfoList.GroupBy(f => f.UserID).Select(f => new MarkupUserInfo { UserId = f.Key, UserName = f.First().UserName });
376

    
377
                    userInfoList.ToList().ForEach(x => ViewerDataModel.Instance._markupUserList.Add(x));
378

    
379
                    e.Result.ToList().ForEach(d =>
380
                    {
381
                        if (d.MarkupList != null)
382
                        {
383
                            d.MarkupList.ForEach(p =>
384
                            {
385
                                if (d.UserID == App.ViewInfo.UserID)
386
                                {
387
                                    d.userDelete = true;
388
                                    d.DisplayColor = "#FFFF0000";
389

    
390
                                    MarkupItemEx markup = new MarkupItemEx
391
                                    {
392
                                        Data = p.Data,
393
                                        Data_Type = p.Data_Type,
394
                                        ID = p.ID,
395
                                        IsUpdate = false,
396
                                        MarkupInfoID = d.MarkupInfoID,
397
                                        PageNumber = p.PageNumber,
398
                                        Symbol_ID = p.Symbol_ID,
399
                                        //Group_ID = p.Group_ID
400
                                    };
401
                                    ViewerDataModel.Instance.MyMarkupList.Add(markup);
402
                                }
403
                                else
404
                                {
405
                                    MarkupItemEx markup = new MarkupItemEx
406
                                    {
407
                                        Data = p.Data,
408
                                        Data_Type = p.Data_Type,
409
                                        ID = p.ID,
410
                                        IsUpdate = false,
411
                                        MarkupInfoID = d.MarkupInfoID,
412
                                        PageNumber = p.PageNumber,
413
                                        Symbol_ID = p.Symbol_ID,
414
                                        //Group_ID = p.Group_ID
415
                                    };
416
                                    ViewerDataModel.Instance.MarkupList_Pre.Add(markup);
417
                                }
418
                            });
419
                        }
420
                    });
421

    
422
                    var currentUser = e.Result.Where(data => data.UserID == App.ViewInfo.UserID && data.AvoidConsolidate == 0).FirstOrDefault();
423

    
424
                    if (currentUser == null)
425
                    {
426
                        /// create a new markupinfo to do comments
427
                        /// 
428
                        if (App.ViewInfo.NewCommentPermission)
429
                        {
430
                            var infoId = Commons.shortGuid();
431
                            PreviewUserMarkupInfoItem = new MarkupInfoItem
432
                            {
433
                                CreateTime = DateTime.Now,
434
                                UpdateTime = DateTime.Now,
435
                                Depatment = userData.DEPARTMENT,
436
                                DisplayColor = "#FFFF0000",
437
                                UserID = userData.ID,
438
                                UserName = userData.NAME,
439
                                PageCount = 1,
440
                                Description = "",
441
                                MarkupInfoID = infoId,
442
                                MarkupList = null,
443
                                MarkupVersionID = Commons.shortGuid(),
444
                                Consolidate = 0,
445
                                PartConsolidate = 0,
446
                                userDelete = true,
447
                                AvoidConsolidate = 0,
448
                                IsPreviewUser = false
449
                            };
450

    
451
                            App.Custom_ViewInfoId = infoId;
452

    
453
                            ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem);
454
                        }
455
                    }
456
                    else
457
                    {
458
                        App.Custom_ViewInfoId = currentUser.MarkupInfoID;
459
                    }
460

    
461
                    ViewerDataModel.Instance.SyncPageNumber = 1;
462

    
463
                    /// Consolidation 된 데이터가 최상단에 올 수 있도록 변경
464
                    //var markupItem = ViewerDataModel.Instance._markupInfoList.OrderByDescending(p => p.Consolidate == Convert.ToInt32(true)).ToList();
465

    
466
                    gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList;
467

    
468
                    SetCommentPages(null);
469

    
470
                    // GRIDVIEW에서 팀별 GROUPING
471
                    // 효성은 안함
472
#if (Hyosung)
473
#else
474
                    /// create a group descriptor
475
                    gridViewMarkup.GroupDescriptors.Clear();
476
                    GroupDescriptor descriptor = new GroupDescriptor();
477
                    descriptor.Member = "Depatment";
478
                    descriptor.DisplayContent = "DEPT";
479
                    //descriptor.SortDirection = ListSortDirection.Ascending;
480
                    gridViewMarkup.GroupDescriptors.Add(descriptor);
481
#endif
482

    
483
                    GridViewMarkup_Sorting(gridViewMarkup, new GridViewSortingEventArgs(gridViewMarkup.Columns[0], SortingState.None, SortingState.None));
484

    
485
                    var SelectedItem = ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == App.ViewInfo.UserID).OrderByDescending(order => order.UpdateTime).FirstOrDefault();
486

    
487
                    if (PreviewUserMarkupInfoItem != null)
488
                    {
489
                        this.gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem;
490
                    }
491
                    else if (SelectedItem != null)
492
                    {
493
                        this.gridViewMarkup.SelectedItem = SelectedItem;
494
                    }
495
                    else if (ViewerDataModel.Instance._markupInfoList.Count() > 0)
496
                    {
497
                        this.gridViewMarkup.SelectedItem = ViewerDataModel.Instance._markupInfoList.First();
498
                    }
499
                }
500
            }
501
            catch (Exception ex) 
502
            {
503
                App.FileLogger.Fatal(ex);
504
            }
505
            finally
506
            {
507
                if(!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled)
508
                {
509
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.btnFinalPDF.IsEnabled = true;
510
                }
511

    
512
                if (!ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled)
513
                {
514
                    ViewerDataModel.Instance.SystemMain.dzMainMenu.btnConsolidate.IsEnabled = true;
515
                }
516
            }
517
        }
518

    
519
        private void GridViewMarkup_Sorting(object sender, GridViewSortingEventArgs e)
520
        {
521
            IEnumerable<IKCOM.MarkupInfoItem> markuplist = e.DataControl.ItemsSource as IEnumerable<IKCOM.MarkupInfoItem>;
522

    
523
            if(markuplist == null)
524
            {
525
                e.Cancel = true;
526
                return;
527
            }
528

    
529
            if(e.NewSortingState == SortingState.None)
530
            {
531
                markuplist = markuplist.OrderByDescending(x => SortIndex(x))
532
                                            .ThenBy(x => x.Depatment)
533
                                            .ThenBy(x => x.UserID);
534

    
535
                e.DataControl.ItemsSource = markuplist.ToList();
536
            }
537
        }
538

    
539

    
540
        // 마크업 리스트 정렬
541
        private int SortIndex(IKCOM.MarkupInfoItem markupInfoItem)
542
        {
543
            int result = 0;
544

    
545
            // Consolidate은 최상단
546
            if (markupInfoItem.Consolidate == 1)
547
            {
548
                result += 2;
549
            }
550

    
551
            /// Consolidate 다음으로 우선순위
552
            if (markupInfoItem.UserID == App.ViewInfo.UserID)
553
            {
554
                result += 1;
555
            }
556

    
557
            return result;
558
        }
559

    
560

    
561
        private void GridViewMarkup_Sorted(object sender, GridViewSortedEventArgs e)
562
        {
563

    
564
        }
565

    
566
        private async void gridViewRevMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
567
        {
568
            List<MarkupInfoItem> gridSelectionItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
569
            //if (ViewerDataModel.Instance.PageBalanceNumber == 0)
570
            //{
571
            //    ViewerDataModel.Instance.PageBalanceNumber = 1;
572
            //}
573

    
574
            if (ViewerDataModel.Instance.SyncPageNumber == 0)
575
            {
576
                ViewerDataModel.Instance.SyncPageNumber = 1;
577
            }
578
            if (e.AddedItems.Count() > 0)
579
            {
580
                foreach (var item in gridSelectionItem)
581
                {
582
                    //item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageBalanceNumber).ToList().ForEach(delegate (MarkupItem markupitem)
583
                    //{
584
                    //    layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID);
585
                    //});
586

    
587
                    var pageItems = item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.SyncPageNumber).ToList();
588

    
589
                    foreach (var markupitem in pageItems)
590
                    {
591
                       await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
592
                    }
593
                }
594
            }
595
            else if (e.RemovedItems.Count > 0)
596
            {
597
                var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList();
598

    
599
                (from A in _infoItem
600
                 from B in Common.ViewerDataModel.Instance.MarkupControls_Sync
601
                 where A.MarkupInfoID == B.MarkupInfoID
602
                 select B).ToList().ForEach(data =>
603
                 {
604
                     Common.ViewerDataModel.Instance.MarkupControls_Sync.Remove(data);
605
                 });
606
            }
607
        }
608

    
609
        /// <summary>
610
        /// 선택한 항목은 Visibility = Visible, 해제한 항목은 Visibility = Hidden 처리한다.
611
        /// </summary>
612
        /// <param name="sender"></param>
613
        /// <param name="e"></param>
614
        private async void gridViewMarkup_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
615
        {
616
            SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
617

    
618
            var dataSet = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID);
619
            var dataSet_User = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(data => data.UserID == _ViewInfo.UserID);
620
            var resultA = (from item_Select in dataSet
621
                           from item_Non in dataSet_User
622
                           where item_Select == item_Non
623
                           select item_Non).ToList();
624

    
625
            if (resultA.Count() >= 2)
626
            {
627
                // 동일한 사용자 데이터가 두개 이상 선택됩니다. Consolidation을 선택할까요?
628
                RadWindow.Confirm(new DialogParameters
629
                {
630
                    Owner = Application.Current.MainWindow,
631
                    Header = "Info",
632
                    Content = "Selected more than two identical user data. Do you want to select consolidation?",
633
                    Closed = new EventHandler<WindowClosedEventArgs>((sen, ea) =>
634
                    {
635
                        if (e.AddedItems.Count() == 1)
636
                        {
637
                            MarkupInfoItem instanceItem = e.AddedItems.FirstOrDefault() as MarkupInfoItem;
638
                            gridViewMarkup.SelectedItem = null;
639

    
640
                        
641
                            if (ea.DialogResult.Value)
642
                            {
643
                                if (instanceItem.Consolidate == 1 || instanceItem.PartConsolidate == 1)
644
                                {
645
                                    gridViewMarkup.SelectedItem = instanceItem;
646
                                }
647
                                else
648
                                {
649
                                    //1. Consolidations이 있다면 하나 선택
650
                                    var Consolidations = resultA.Where(item => (item.Consolidate == 1 || item.PartConsolidate == 1));
651

    
652
                                    if (Consolidations.Count() > 0)
653
                                    {
654
                                        gridViewMarkup.SelectedItem = Consolidations.First();
655
                                    }
656
                                }
657
                              
658
                            }
659
                            else {
660
                                //1. Consolidations 아닌게 있다면 Change
661
                                var notConsolidations = resultA.Where(item => !(item.Consolidate == 1 || item.PartConsolidate == 1));
662

    
663
                                if(notConsolidations.Count() > 0) {
664
                                    gridViewMarkup.SelectedItem = notConsolidations.First();
665
                                }
666
                                else {//1. Consolidations 아닌게 없다면 그대로
667
                                    gridViewMarkup.SelectedItem = instanceItem;
668
                                }
669
                                
670
                            }
671
                        }
672
                    }),
673
                    Theme = new Windows8Theme(),
674
                    ModalBackground = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Colors.Black, Opacity = 0.6 },
675
                });
676
            }
677
            else //파라미터로 넘어온 사용자가 걸리지 않은 경우
678
            {
679
                List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업
680
                List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
681
                List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업
682
#region 코멘트 보기
683
                if (e.AddedItems.Count() > 0 && this.pageNavigator.CurrentPage != null)
684
                {
685
                    foreach (var item in gridSelectionItem)
686
                    {
687
                        if (item.UserID == App.ViewInfo.UserID)
688
                        {
689
                            var controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
690
                            if (controls.Count == 0)
691
                            {
692
                                var instance = ViewerDataModel.Instance.MyMarkupList.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
693

    
694
                                foreach (var markup in instance)
695
                                {
696
                                    await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", 
697
                                        item.MarkupInfoID, markup.ID,STAMP_Contents:App.SystemInfo.STAMP_CONTENTS);
698
                                }
699
                            }
700

    
701
                            controls = Common.ViewerDataModel.Instance.MarkupControls_USER.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
702
                            foreach (var control in controls)
703
                            {
704
                                Logger.sendCheckLog(String.Format("=={0}", control), 1);
705
                                control.Visibility = Visibility.Visible;
706
                            }
707
                        }
708
                        else
709
                        {
710
                            var controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
711
                            if (controls.Count == 0)
712
                            {
713
                                var instance = ViewerDataModel.Instance.MarkupList_Pre.Where(d => d.PageNumber == this.pageNavigator.CurrentPage.PageNumber && d.MarkupInfoID == item.MarkupInfoID).ToList();
714
                                foreach (var markup in instance)
715
                                {
716
                                    await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markup.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "",
717
                                        item.MarkupInfoID, markup.ID);
718
                                }
719
                            }
720

    
721
                            controls = Common.ViewerDataModel.Instance.MarkupControls.Where(d => d.MarkupInfoID == item.MarkupInfoID).ToList();
722
                            foreach (var control in controls)
723
                            {
724
                                control.Visibility = Visibility.Visible;
725
                            }
726
                        }
727
                    }
728
                }
729
#endregion
730
#region 코멘트 숨기기
731
                else if (e.RemovedItems.Count > 0)
732
                {
733
                    var _infoItem = e.RemovedItems.Cast<MarkupInfoItem>().ToList();
734

    
735
                    (from A in _infoItem
736
                     from B in Common.ViewerDataModel.Instance.MarkupControls
737
                     where A.MarkupInfoID == B.MarkupInfoID
738
                     select B).ToList().ForEach(data =>
739
                     {
740
                         data.Visibility = Visibility.Hidden;                         
741
                     });
742

    
743

    
744
                    var myComment = _infoItem.Where(d => d.UserID == App.ViewInfo.UserID).FirstOrDefault();
745
                    if (myComment != null)
746
                    {
747
                        Common.ViewerDataModel.Instance.MarkupControls_USER.ToList().ForEach(delegate (MarkupToPDF.Common.CommentUserInfo markupitem)
748
                        {
749
                            markupitem.Visibility = Visibility.Hidden;
750
                        });
751
                    }
752
                }
753
#endregion
754
            }
755
        }
756

    
757
        private void BaseClient_GetDocumentItemInfoCompleted(object sender, GetDocumentItemInfoCompletedEventArgs e)
758
        {
759
            //Logger.sendResLog("GetDocumentItemInfoCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result?.DOCUMENT_ID + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
760

    
761
            if (e.Result != null)
762
            {
763
                _DocItem = e.Result;
764

    
765
                if (e.Result.DOCUMENT_NO == "" && e.Result.DOCUMENT_NAME == "" && e.Result.GROUP_NO == "0")
766
                {
767
                    _ViewInfo.UserID = _ViewInfo.UserID.Replace(@"DAELIM\", "");
768
                }
769
                ////Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
770
                BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
771
            }
772
            else
773
            {
774
                DialogMessage_Alert("Document Information Not Found.", "Error");
775

    
776
                BaseClient.GetCheckSystemAdminCompleted += (sen, ea) =>
777
                {
778
                    //Logger.sendResLog("GetCheckSystemAdminCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1);
779

    
780
                    if (ea.Error == null)
781
                    {
782
                        if (ea.Result)
783
                        {
784
                            this._ViewInfo.isAdmin = true;
785
                            //Logger.sendReqLog("GetDocInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
786
                            BaseClient.GetDocInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
787
                        }
788
                        else
789
                        {
790
                            //System.Windows.Forms.MessageBox.Show("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내");
791
                            DialogMessage_Alert("You are not belong to this project. Please ask admin for an authority.", "Info");
792
                            //this.ParentOfType<MainPage>().DialogMessage_Alert("해당 프로젝트에 가입되지 않은 유저입니다. 관리자에게 등록신청을 해주세요", "안내");
793
                        }
794

    
795
                    }
796
                    else
797
                    {
798
                        //System.Windows.Browser.HtmlPage.Window.Invoke("close");
799
                    }
800
                };
801
                //Logger.sendReqLog("GetCheckSystemAdminAsync", _ViewInfo.UserID, 1);
802
                BaseClient.GetCheckSystemAdminAsync(this._ViewInfo.UserID);
803
            }
804
        }
805

    
806
        private void BaseClient_GetSystemDataCompleted(object sender, GetSystemDataCompletedEventArgs e)
807
        {
808
            //Logger.sendResLog("GetSystemDataCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
809

    
810
            if (e.Error == null && e.Result != null)
811
            {
812
                App.SystemInfo = e.Result;
813

    
814
                //App.urlPort_DB = App.SystemInfo.HostPort;
815
                //App.urlHost_DB = App.SystemInfo.HostName;
816
                //Logger.sendReqLog("GetConversionStateAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID, 1);
817
                BaseClient.GetConversionStateAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID });
818

    
819
                //if (App.urlHost.Contains("localhost"))
820
                //{
821
                //    App.urlHost = App.urlHost_DB;
822
                //}
823
            }
824
        }
825

    
826
        private void BaseClient_GetConversionStateCompleted(object sender, GetConversionStateCompletedEventArgs e)
827
        {
828
            
829
            //Logger.sendResLog("GetConversionStateCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1);
830
            string failedmsg = CommonLib.Common.GetAlertMessageString("GetConversionStateFailed", "MSG", "Too Many V/P Files are uploading instantaneously, This V/P file can not be open now. Please feel free to re-open wait a moment again!\n\n현재 일시적으로 많은 양의 V/P가 등록되고 있어 이 문서를 열람할 수 없습니다.\n잠시만 기다려 주신 후 다시 열람하여 주시기 바랍니다");
831
            if (e.Error == null && e.Result == true)
832
            {
833
                //Logger.sendReqLog("GetDocumentItemInfoAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + _ViewInfo.UserID, 1);
834

    
835
                BaseClient.GetDocumentItemInfoAsync(new KCOM_BasicParam { projectNo = _ViewInfo.ProjectNO, documentID = _ViewInfo.DocumentItemID, userID = _ViewInfo.UserID });
836

    
837
                if (App.ViewInfo != null && App.ViewInfo.ProjectNO != "")
838
                {
839
                    //Logger.sendReqLog("GetMember", _ViewInfo.ProjectNO + "," + _ViewInfo.UserID, 1);
840
                    userData = BaseClient.GetMember(App.ViewInfo.ProjectNO, App.ViewInfo.UserID);
841
                    if (userData != null)
842
                    {
843
                        //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1);
844
                        BaseClient.GetDeptDataAsync(userData.DEPARTMENT);
845
                    }
846
                    else
847
                    {
848
                        userData = new MEMBER();
849
                        userData.DEPARTMENT = "ALL";
850
                        //Logger.sendReqLog("GetDeptDataAsync", userData.DEPARTMENT, 1);
851
                        BaseClient.GetDeptDataAsync(userData.DEPARTMENT);
852
                    }
853
                }
854
            }
855
            else
856
            {
857
                
858
                DialogMessage_Alert(failedmsg, "Warning");
859
            }
860
        }
861

    
862
        public void SetView(ViewInfo info)
863
        { 
864
            this._ViewInfo = info;
865
            try
866
            {
867
                /// 대림의 경우 EnsembleID를 가지고 DocumentItemID를 구함
868
                /// 다른 Site를 대비하여 에러 처리함
869
                string docid = BaseClient.GetDocItemID(info.EnsembleID);
870
                if (!string.IsNullOrEmpty(docid))
871
                {
872
                    this._ViewInfo.DocumentItemID = docid;
873
                }
874
            }
875
            catch(Exception ex)
876
            {
877

    
878
                //App.FileLogger.Fatal(ex);
879
            }
880

    
881
            //Logger.sendReqLog("GetSystemDataAsync", "", 1);
882

    
883
            BaseClient.GetSystemDataAsync();
884
        }
885

    
886
        public void HubSet()
887
        {
888
            // 허브 연결 구성
889
            var hubConnection = new HubConnection(CommonLib.Common.GetConfigString("HubAddress", "URL", "", App.isExternal));
890
            IHubProxy MarkusLicenseProxy = hubConnection.CreateHubProxy("MarkusLicenseHub");
891

    
892

    
893
            // 허브 연결 
894
            hubConnection.Start().ContinueWith(task =>
895
            {
896
                if (task.IsFaulted)
897
                {
898
                    Console.WriteLine("There was an error opening the connection:{0}",
899
                                      task.Exception.GetBaseException());
900
                    //throw task.Exception.GetBaseException();
901
                }
902
                else
903
                {
904
                    Console.WriteLine("Connected :: " + task.Id);
905
                }
906

    
907
            }).Wait();
908

    
909

    
910
            // [ 프로그램 시작 ]
911
            // 클라이언트에서 서버를 호출 ( 접속 시 )  : 라이센스 체크
912
            //( "method name", arg1, arg2 )
913
            //MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", "H2009115", "고동균").ContinueWith(task =>
914
            //{
915
            //    if (task.IsFaulted)
916
            //    {
917
            //        Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException());
918
            //    }
919
            //    else
920
            //    {
921
            //        Console.WriteLine(task.Result);
922
            //    }
923
            //});
924
            MarkusLicenseProxy.Invoke<string>("ConnectionMarkus", App.ViewInfo.UserID,App.ViewInfo.ProjectNO).ContinueWith(task =>
925
            {
926
                if (task.IsFaulted)
927
                {
928
                    Console.WriteLine("ConnectionMarkus :: There was an error calling send: {0}", task.Exception.GetBaseException());
929
                    //throw task.Exception.GetBaseException();
930
                }
931
                else
932
                {
933
                    switch (task.Result)
934
                    {
935
                        case "2":
936
                            {
937
                                var result = MessageBox.Show("권한이 없습니다.");
938
                                if (result == MessageBoxResult.OK)
939
                                    System.Diagnostics.Process.GetCurrentProcess().Kill();
940
                            }
941
                            break;
942
                        case "404":
943
                            {
944
                                var result = MessageBox.Show("등록된 사용자가 아닙니다.");
945
                                if(result == MessageBoxResult.OK)
946
                                    System.Diagnostics.Process.GetCurrentProcess().Kill();
947
                            }
948
                            break;
949
                    }
950
                }
951
            });
952

    
953
            // 서버에서 클라이언트 호출 ( 프로그램 구동여부 ) : 라이센스 체크 후 응답 ( 반환값 : true, false ) 
954
            //MarkusLicenseProxy.On<bool>("IsConnection", status =>
955
            //{
956

    
957
            //    if (status)
958
            //    {
959
            //        // 프로그램 시작 
960
            //        Console.WriteLine("connection status : " + status);
961
            //    }
962
            //    else
963
            //    {
964
            //        // 프로그램 종료 ( signalr 접속 끊기 )  
965
            //        hubConnection.Stop();
966
            //    }
967
            //});
968

    
969
            // 공지 메세지 ( 서버에서 클라이언트 호출 ) 
970
            MarkusLicenseProxy.On<string>("MarkusNotification", msg =>
971
                Console.WriteLine("Noficiation Message : " + msg)
972
            );
973

    
974

    
975
            // 서버 메서드 호출 
976
            //MarkusLicenseProxy.Invoke<string>("DoSomething", "I'm doing something!!!").Wait();
977

    
978
            //Console.ReadKey();
979

    
980
            //hubConnection.Stop();
981
        }
982

    
983
        public async void MarkupUserListDisplay()
984
        {
985
            List<MarkupInfoItem> gridItem = gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList(); //전체 마크업
986
            List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업
987
            List<MarkupInfoItem> gridNonSelectionItem = gridItem.Except(gridSelectionItem).ToList(); //선택 되지 않은 마크업
988
                                                                                                     //MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl();
989
            Common.ViewerDataModel.Instance.MarkupControls_USER.Clear();  //전체 제거
990
            Common.ViewerDataModel.Instance.MarkupControls.Clear();  //전체 제거
991
            //foreach (var item in gridSelectionItem)
992
            //{
993
            //    if (item.UserID == App.ViewInfo.UserID)
994
            //    {
995
            //        ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
996
            //        {
997
            //            layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID);
998
            //        });
999
            //    }
1000
            //    else
1001
            //    {
1002
            //        ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem)
1003
            //        {
1004
            //            layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID);
1005
            //        });
1006
            //    }
1007
            //}
1008
                (from A in gridSelectionItem
1009
                 from B in Common.ViewerDataModel.Instance.MarkupControls_USER
1010
                 where A.MarkupInfoID == B.MarkupInfoID
1011
                 select B).ToList().ForEach(data =>
1012
                 {
1013
                     Common.ViewerDataModel.Instance.MarkupControls_USER.Remove(data);
1014
                 });
1015
            (from A in gridSelectionItem
1016
             from B in Common.ViewerDataModel.Instance.MarkupControls
1017
             where A.MarkupInfoID == B.MarkupInfoID
1018
             select B).ToList().ForEach(data =>
1019
             {
1020
                 Common.ViewerDataModel.Instance.MarkupControls.Remove(data);
1021
             });
1022

    
1023
            foreach (var item in gridSelectionItem)
1024
            {
1025

    
1026
                if (item.UserID == App.ViewInfo.UserID)
1027
                {
1028
                    var markupItems = ViewerDataModel.Instance.MyMarkupList.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList();
1029

    
1030
                    foreach (var markupitem in markupItems)
1031
                    {
1032
                        await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", 
1033
                                item.MarkupInfoID, markupitem.ID);
1034
                    }
1035
                }
1036
                else
1037
                {
1038
                    var markupItems = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList();
1039

    
1040
                    foreach (var markupitem in markupItems)
1041
                    {
1042
                        await MarkupParser.ParseExAsync(App.BaseAddress, ViewerDataModel.Instance.NewMarkupCancelToken(), App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, ViewerDataModel.Instance.PageAngle, item.DisplayColor, "", item.MarkupInfoID);
1043
                    }
1044
                }
1045
            }
1046
        }
1047
    }
1048
}
클립보드 이미지 추가 (최대 크기: 500 MB)