프로젝트

일반

사용자정보

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

markus / KCOM / Controls / Sample.xaml.cs @ d7e20d2d

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

1
using IKCOM;
2
using KCOM.Common;
3
using KCOMDataModel.DataModel;
4
using MarkupToPDF.Common;
5
using MarkupToPDF.Controls.Parsing;
6
using System;
7
using System.Collections.Generic;
8
using System.Collections.ObjectModel;
9
using System.ComponentModel;
10
using System.Diagnostics;
11
using System.Linq;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Input;
15
using System.Windows.Media;
16
using Telerik.Windows.Controls;
17
using static MarkupToPDF.Controls.Parsing.MarkupParser;
18

    
19
namespace KCOM.Controls
20
{
21
    /// <summary>
22
    /// Interaction logic for PageNavigator.xaml
23
    /// </summary>
24
    public partial class Sample : UserControl, INotifyPropertyChanged
25
    {
26
        public List<FAVORITE_DOC> _FavoriteSet { get; set; }
27
        public event PropertyChangedEventHandler PropertyChanged;
28
        public Sample()
29
        {
30
            InitializeComponent();
31

    
32
            if (App.IsDesignMode)
33
            {
34
                return;
35
            }
36

    
37
            //App.splashString(ISplashMessage.SAMPLE);
38
            this.Loaded += Sample_Loaded;
39
        }
40

    
41
        private void Sample_Loaded(object sender, RoutedEventArgs e)
42
        {
43
            if(!_Initialize)
44
            {
45
                _Initialize = true;
46

    
47
                this.lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged);
48
                this.ImgListbox.SelectionChanged += new SelectionChangedEventHandler(ImgListbox_SelectionChanged);                
49
            }            
50
        }
51

    
52
        public ObservableCollection<ThumbnailItem> _thumbnailItems;
53
        private List<DOCPAGE> _PageList = null;
54
        private string _DefaultUri = null;
55
        public ThumbnailItem CurrentPage = null;
56
        public int PageCount = 0;
57
        private bool _Initialize;
58
        public event EventHandler<PageChangeEventArgs> PageChanged;
59
        public event EventHandler<PageChangeEventArgs> PageChanging;
60

    
61
        private List<UsersCommentPagesMember> _UsersCommentPagesList;
62

    
63
        public List<UsersCommentPagesMember> UsersCommentPagesList
64
        {
65
            get {
66
                if(_UsersCommentPagesList == null)
67
                {
68
                    _UsersCommentPagesList = new List<UsersCommentPagesMember>();
69
                }
70

    
71
                return _UsersCommentPagesList; }
72
            set { _UsersCommentPagesList = value; }
73
        }
74

    
75
        public class PageChangeEventArgs : EventArgs
76
        {
77
            public DOCPAGE CurrentPage { get; set; }
78
            public string PageUri { get; set; }
79
            public int PageNumber { get; set; }
80
        }
81
        private bool _IsFitOn { get; set; }
82
        public bool IsFitOn
83
        {
84
            get
85
            {
86
                return _IsFitOn;
87
            }
88
            set
89
            {
90
                _IsFitOn = value;
91
                RaisePropertyChanged("IsFitOn");
92
            }
93
        }
94

    
95
        public void RaisePropertyChanged(string propName)
96
        {
97
            if (PropertyChanged != null)
98
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
99
        }
100

    
101
        public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri)
102
        {
103
            this._PageList = PageList;
104
            this._DefaultUri = DefaultUri;
105
            ThumbnailSet();
106
            this.PageCount = PageList.Count();
107
            //ThumbNmailSet();
108
            rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked);
109
            rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked);
110
            expCommentPages.PreviewCollapsed += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewCollapsed);
111
            expCommentPages.PreviewExpanded += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewExpanded);
112
        }
113

    
114
        void rdoCommented_Checked(object sender, RoutedEventArgs e)
115
        {
116
            Logger.sendCheckLog("rdoCommented_Checked", 1);
117
            if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false;
118
            SetCommentPages();
119
        }
120

    
121
        void rdoFavoritePages_Checked(object sender, RoutedEventArgs e)
122
        {
123
            Logger.sendCheckLog("rdoFavoritePages_Checked", 1);
124
            if (rdoFavoritePages.IsChecked == true)
125
                expCommentPages.IsExpanded = false;
126

    
127
            _FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet;
128
            if (_FavoriteSet.Count > 0)
129
            {
130
                SetCommentPages_Favorite(); //수정    
131
            }
132
            else
133
            {
134
                rdoAllPages.IsChecked = true;
135
                rdoFavoritePages.IsChecked = false;
136
            }
137
        }
138

    
139
        private void SetCommentPages_Favorite()
140
        {
141
            ThumbnailSet();            
142
            SetCommentPages();
143
        }
144

    
145
        void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e)
146
        {
147
            //txtThumbCount.Visibility = Visibility.Collapsed;            
148
        }
149

    
150
        void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e)
151
        {
152
            Logger.sendCheckLog("expCommentPages_PreviewExpanded", 1);
153
            rdoAllPages.IsChecked = false;
154
            rdoFavoritePages.IsChecked = false;
155
            //txtThumbCount.Visibility = Visibility.Visible;
156
            SetCommentPages();
157
        }
158

    
159
        /// <summary>
160
        /// called when image list box's selection is changed
161
        /// </summary>
162
        /// <param name="sender"></param>
163
        /// <param name="e"></param>
164
        private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
165
        {
166
            if (ImgListbox.SelectedItem != null)
167
            {
168
                int _CurrentPageNo = -1;
169
                if (this.CurrentPage != null)
170
                {
171
                    ViewerDataModel.Instance.SystemMain.dzTopMenu._SaveEvent(null, null);   /// save controls
172

    
173
                    _CurrentPageNo = this.CurrentPage.PageNumber;
174
                }
175

    
176
                this.CurrentPage = ImgListbox.SelectedItem as ThumbnailItem;
177
                int iPageNo = this.CurrentPage.PageNumber;
178
                if(_CurrentPageNo != iPageNo)
179
                {
180
                    PageChanging(this, new PageChangeEventArgs
181
                    {
182
                        CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(),
183
                        PageNumber = iPageNo,
184
                        PageUri = null
185
                    });
186
                }
187
            }
188

    
189
            //var border = VisualTreeHelper.GetChild(ImgListbox, 0);
190
            //if (border != null)
191
            //{
192
            //    IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>();
193

    
194
            //}
195
            //ScrollViewer scrollViewer = (sender as RadListBox) as ScrollViewer;
196

    
197
            
198
            //System.Diagnostics.Debug.WriteLine("page:"+ImgListbox.SelectedIndex);
199
        }
200

    
201
        public bool GotoPageFlag = false;
202

    
203
        /// <summary>
204
        /// 해당 썸네일로 이동
205
        /// </summary>
206
        /// <param name="_pageNumber">이동할 페이지 번호</param>
207
        public void GotoPage(int _pageNumber)
208
        {
209
            try
210
            {
211
                System.Threading.Tasks.Task.Factory.StartNew(() => { 
212

    
213
                    var _page = _thumbnailItems.Where(item => item.PageNumber == _pageNumber);
214
                    if (_page.Count() > 0)
215
                    {
216
                        ThumbnailItem thumbnailitem = _page.First();
217
                        if (PageChanging != null)
218
                        {
219

    
220
                            ImgListbox.Dispatcher.InvokeAsync(() => {  
221
                                var _itemIndex = this._thumbnailItems.IndexOf(thumbnailitem);
222
                                ImgListbox.SelectedItem = thumbnailitem;
223
                            });
224
                            //ImgListbox.Items.MoveCurrentTo(thumbnailitem);
225
                            //if (_itemIndex < _thumbnailItems.Count() - 1)
226
                            //    ImgListbox.ScrollIntoView(_itemIndex);
227
                            //else
228
                            //    ImgListbox.ScrollIntoView(this._thumbnailItems.Count() - 1);
229
                        }
230
                    }
231

    
232
                }).ConfigureAwait(true);
233
            }
234
            catch(Exception ex)
235
            {
236
                Logger.sendResLog("GotoPage", ex.Message, 0);
237
            }
238
        }
239

    
240
        /// <summary>
241
        /// 주어진 페이지로 변경한다
242
        /// </summary>
243
        /// <param name="iPageNo">변경할 페이지 번호</param>
244
        public void ChangePage(int iPageNo)
245
        {
246
            var thumbitem = this._thumbnailItems.Where(item => item.PageNumber == iPageNo).FirstOrDefault();
247
            if ((PageChanged != null) && (thumbitem != null))
248
            {
249
                var uri = thumbitem.PageUri.ToString();
250
                    //_DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString());
251

    
252
                var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber).FirstOrDefault();
253
                if (_DocPages != null)
254
                {
255
                    PageChanged(this, new PageChangeEventArgs
256
                    {
257
                        CurrentPage = _DocPages,
258
                        PageUri = uri,
259
                        PageNumber = thumbitem.PageNumber
260
                    });
261
                    //ImgListbox.SelectedItem = thumbitem;                    
262
                    //ImgListbox.Items.MoveCurrentTo(thumbitem);
263
                    
264
                    this.CurrentPage = thumbitem;
265
                }
266
                else
267
                {
268
                    //System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다");
269
                }
270
            }
271
        }
272

    
273
        public void GotoPageTALK(int _pageNumber, int _angle)
274
        {
275
            int _PageNo = -1;
276

    
277
            if (int.TryParse(_pageNumber.ToString(), out _PageNo))
278
            {
279
                var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo);
280
                if (_page.Count() > 0)
281
                {
282
                    ThumbnailItem _item = _page.First();
283
                    setPageChangeTALK(_item, _angle);
284
                    this.ImgListbox.SelectedIndex = _pageNumber - 1;
285
                    //this.ImgListbox.ScrollIntoView(_pageNumber - 1);
286
                }
287
            }
288
        }
289

    
290
        public void setPageChangeTALK(ThumbnailItem thumbnailItem, int _angle)
291
        {
292
            if (thumbnailItem != null)
293
            {
294
                if (PageChanging != null)
295
                {
296
                    ///this.CurrentPage = _NextPage;
297
                    ///_NextPage = thumbnailItem;
298
                    PageChanging(this, new PageChangeEventArgs
299
                    {
300
                        CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(),
301
                        PageNumber = Convert.ToInt32(thumbnailItem.PageNumber),
302
                        PageUri = null
303
                    });
304

    
305
                    var instanceMain = this.ParentOfType<MainWindow>();
306

    
307
                    var rotationNum = (_angle - instanceMain.dzMainMenu.rotate.Angle) / 90;
308

    
309
                    if (rotationNum > 0) // 1, 2, 3
310
                    {
311
                        for (int i = 0; i < rotationNum; i++)
312
                        {
313
                            drawingPannelRotate(true);
314
                        }
315
                    }
316
                    else if (rotationNum < 0)// -1, -2, -3
317
                    {
318
                        for (int i = 0; i < -rotationNum; i++)
319
                        {
320
                            drawingPannelRotate(false);
321
                        }
322
                    }
323
                }
324
            }
325
        }
326

    
327
        public void drawingPannelRotate(bool Flag)
328
        {
329
            var instanceMain = this.ParentOfType<MainWindow>();
330

    
331
            if (Flag)
332
            {
333
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
334
                {
335
                    instanceMain.dzMainMenu.rotate.Angle = 0;
336
                }
337
                else
338
                {
339
                    instanceMain.dzMainMenu.rotate.Angle += 90;
340
                }
341
            }
342
            else
343
            {
344
                if (instanceMain.dzMainMenu.rotate.Angle == 0)
345
                {
346
                    instanceMain.dzMainMenu.rotate.Angle = 270;
347
                }
348
                else
349
                {
350
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
351
                }
352
            }
353

    
354
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
355
            {
356
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
357
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
358
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
359
            }
360

    
361
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
362
            {
363
                instanceMain.dzMainMenu.translate.X = 0;
364
                instanceMain.dzMainMenu.translate.Y = 0;
365
            }
366
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
367
            {
368
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
369
                instanceMain.dzMainMenu.translate.Y = 0;
370
            }
371
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
372
            {
373
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
374
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
375
            }
376
            else
377
            {
378
                instanceMain.dzMainMenu.translate.X = 0;
379
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
380
            }
381

    
382
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
383
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
384
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
385
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
386
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
387
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
388

    
389
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
390
            {
391
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
392

    
393
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
394
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
395
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
396

    
397
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
398
                if (rotationdoc != null)
399
                {
400
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
401
                }
402
                else
403
                {
404
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
405
                }
406
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
407
            });
408
        }
409

    
410
        void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
411
        {
412
            SetCommentPages();
413
        }
414
        
415
        void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
416
        {
417
            SetCommentPages();
418
            //System.Diagnostics.Debug.WriteLine(e.PropertyName);
419
        }
420

    
421
        public void SetCommentPages()
422
        {
423
            ThumbnailSet();
424
            SetCommentList(UsersCommentPagesList.ToList());
425
        }
426

    
427
        public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList)
428
        {
429
            Logger.sendCheckLog("SetCommentList", 1);
430
            Logger.sendCheckLog("SetCommentList_기존 Comment 색상 제거", 1);
431
            #region 기존 색상 제거 작업
432
            foreach (var item in this._thumbnailItems)
433
            {
434
                item.DisplayColorItems.Clear();
435
            }
436
            #endregion
437

    
438
            Logger.sendCheckLog("SetCommentList_delItem select 및 remove", 1);
439
            List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>();
440

    
441
            this.UsersCommentPagesList.ToList().ForEach(item =>
442
            {
443
                var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID);
444

    
445
                if (_comm.Count() == 0)
446
                {
447
                    _delItem.Add(item);
448
                }
449
            });
450

    
451
            _delItem.ForEach(f => this.UsersCommentPagesList.Remove(f));
452

    
453
            Logger.sendCheckLog("SetCommentList_UsersCommentPagesMember_PropertyChanged", 1);
454
            List<SetColorMarkupItem> setColorMarkupItems = new List<SetColorMarkupItem>();
455

    
456
            UsersCommentPagesList.ForEach(user =>
457
            {
458
                user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
459
                user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
460

    
461
                var _commLst = this.UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID);
462

    
463
                if (_commLst.Count() == 0)
464
                {
465
                    this.UsersCommentPagesList.Add(user);
466
                }
467
                else
468
                {
469
                    if (_commLst.First().PageNumber != user.PageNumber)
470
                        _commLst.First().PageNumber = user.PageNumber;
471
                }
472

    
473
                user.PageNumber.ForEach(page =>
474
                {
475
                    var _items = this._thumbnailItems.Where(item => item.PageNumber == page);
476

    
477
                    if (_items.Count() > 0)
478
                    {
479
                        setColorMarkupItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor, markupID = user.MarkupInfoID, Page = page });
480
                        
481
                    }
482
                        
483
                });
484
            });
485

    
486
            foreach (var item in this._thumbnailItems)
487
            {
488
                item.DisplayColorItems = setColorMarkupItems.Where(color => color.Page == item.PageNumber).ToList();
489
            }
490
            
491
            Logger.sendCheckLog("SetCommentList_SelectComment.ItemsSource 설정", 1);
492
            var data = UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList();
493
            if (data.Count() != 0)
494
            {
495
                if (Convert.ToBoolean(data.First().isConSolidation))
496
                {
497
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated";
498
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = "";
499
                    this.lstSelectComment.ItemsSource = data;
500
                }
501
                else
502
                {
503
                    this.lstSelectComment.ItemsSource = this.UsersCommentPagesList;  //섬네일   
504
                }
505
            }
506
            else
507
            {
508
                this.lstSelectComment.ItemsSource = this.UsersCommentPagesList;  //섬네일   
509
            }
510

    
511
            Logger.sendCheckLog("SetComme6ntList_ImgListbox 설정", 1);
512

    
513

    
514
            //var template = this.ImgListbox.ItemTemplate;
515
            //this.ImgListbox.ItemTemplate = null;
516
            //this.ImgListbox.ItemTemplate = template;
517

    
518
        }
519

    
520
        private void ThumbnailSet()
521
        {
522
            Logger.sendCheckLog("ThumbnailSet", 1);
523
            if (!_Initialize) return;
524

    
525
            this._thumbnailItems = new ObservableCollection<ThumbnailItem>();
526
            List<int> _selectComment = new List<int>();
527
            if (this.lstSelectComment.ItemsSource != null)
528
            {
529
                var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>()
530
                             where commentPage.IsSelected == true
531
                             select commentPage.PageNumber;
532

    
533
                foreach (var item in _pages)
534
                {
535
                    item.ForEach(pp => _selectComment.Add(pp));
536
                }
537

    
538
                _selectComment.Distinct();
539
            }
540

    
541
            var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0");
542
            this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList();
543
            //this._PageList.ForEach(page =>
544
            ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page =>
545
            {
546
                var _pageNo = page.PAGE_NUMBER;
547
                bool _addFlag = false;
548

    
549
                if (rdoFavoritePages.IsChecked == false)
550
                {
551
                    if (_selectComment.Count() > 0)
552
                    {
553
                        if ((rdoAllPages.IsChecked == true)
554
                            || (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0))
555
                        {
556
                            _addFlag = true;
557
                        }
558
                    }
559
                    else
560
                    {
561
                        //if (App.ViewInfo.IsCustomPage)
562
                        //{
563
                        //    //_addFlag = false;
564

    
565
                        //    //App.ViewInfo.IsCustomPage = false;
566
                        //    //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed;
567
                        //    //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed;
568
                        //    this.rdoAllPages.IsChecked = false;
569
                        //    this.rdoFavoritePages.IsChecked = true;
570
                        //    //SetCommentPages();                        
571
                        //}
572
                        //else
573
                        //{
574
                        _addFlag = true;
575
                        //}
576
                    }
577
                }
578

    
579

    
580
                if (_addFlag)
581
                {
582
                    this._thumbnailItems.Add(new ThumbnailItem
583
                    {
584
                        ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
585
                        PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")),
586
                        PageNumber = _pageNo,
587
                        Angle = page.PAGE_ANGLE,
588
                    });
589
                }
590
                else
591
                {
592
                    if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null)
593
                    {
594
                        this._thumbnailItems.Add(new ThumbnailItem
595
                        {
596
                            ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
597
                            PageNumber = _pageNo,
598
                            Angle = page.PAGE_ANGLE,
599
                        });
600
                    }
601
                }
602

    
603

    
604

    
605
                //this._thumbnailItems.Add(new ThumbnailItem
606
                //{
607
                //    ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
608

    
609
                //    //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"),
610

    
611
                //    //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"),
612
                //    //DisplayColorItems = pageColor,
613
                //    PageNumber = Convert.ToInt32(_pageNo),
614
                //    Angle = Convert.ToInt32(page.PAGE_ANGLE),
615
                //});
616
            });
617

    
618
            //txtTotPageNo.Text = this._PageList.Count().ToString();
619

    
620
            //txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString());
621

    
622
            if (ImgListbox.ItemsSource == null)
623
            {
624
                ImgListbox.ItemsSource = this._thumbnailItems;
625

    
626
                this._thumbnailItems.ToList().ForEach(data =>
627
                {
628
                    data.Width = ImgListbox.ActualWidth;
629
                    data.Height = ImgListbox.ActualHeight;
630
                });
631

    
632
                if (ImgListbox.Items.Count > 0)
633
                {
634
                    //int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1;
635
                    int StartPageIdx = 1;
636
                    //if (App.ViewInfo.IsCustomPage)
637
                    //{
638
                    //    ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault();
639
                    //}
640
                    //else
641
                    //{
642

    
643
                    if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1)
644
                    {
645
                        ImgListbox.SelectedItem = ImgListbox.Items[0];
646
                    }
647
                    else
648
                    {
649
                        ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx];
650
                    }
651
                    //}
652
                }
653
            }
654
            else
655
            {
656
                ImgListbox.UpdateLayout();
657
                ImgListbox.ItemsSource = this._thumbnailItems;
658
            }
659
        }
660

    
661
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
662
        {
663
            if (e.ClickCount >= 2)
664
            {
665
                var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem;
666
                GotoPage(selectItem.PageNumber);
667
                var result = MarkupParser.GetBaseControl(selectItem.Data);
668
                Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100));
669
                this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
670
                //bool isGO = false;
671

    
672
                //var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer;
673
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
674
                //imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle;
675
                //imageViewer.InteractiveUserRectangle += (sen, ea) =>
676
                //{
677
                //    System.Diagnostics.Debug.WriteLine(ea.Bounds);
678
                //    if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End)
679
                //    {
680
                //        this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds);                        
681
                //    }
682

    
683
                //};
684
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal;
685

    
686
                //GotoPage(MarkupList.SelectedItem as MarkupList)
687
            }
688
        }
689

    
690
        public class MarkupInfoItemSmall
691
        {
692
            public string Id { get; set; }
693
            public string UserName { get; set; }
694
            public string UserID { get; set; }
695
            public int PageNumber { get; set; }
696
            public string Data { get; set; }
697
            public int Data_Type { get; set; }
698
            public bool IsConsolidate { get; set; }
699
        }
700

    
701
        private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; }
702
        public List<MarkupInfoItemSmall> MarkupInfoSmallList
703
        {
704
            get
705
            {
706
                if (_MarkupInfoSmallList == null)
707
                {
708
                    _MarkupInfoSmallList = new List<MarkupInfoItemSmall>();
709
                }
710
                return _MarkupInfoSmallList;
711
            }
712
            set
713
            {
714

    
715
                _MarkupInfoSmallList = value;
716
                RaisePropertyChanged("MarkupInfoSmallList");
717
            }
718
        }
719

    
720
        /// <summary>
721
        /// goto page and select item selected by user
722
        /// </summary>
723
        /// <param name="sender"></param>
724
        /// <param name="e"></param>
725
        private void RadButton_Click_OLD(object sender, RoutedEventArgs e)
726
        {
727
            var clickButtonItem = sender as RadButton;
728
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
729
            {
730
                try
731
                {
732
                    Rect rect = new Rect();
733
                    Point s_point = new Point();
734
                    Point e_point = new Point();
735

    
736
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
737
                    GotoPage(Convert.ToInt32(gaza.PageNumber));
738

    
739
                    var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업
740
                    switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString()))
741
                    {
742
                        case MarkupToPDF.Controls.Common.ControlType.TextControl:
743
                            {
744
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
745
                                rect = new Rect(new Point(instance.StartPoint.X - 100, instance.StartPoint.Y - 100), new Point(instance.StartPoint.X + instance.BoxW + 100, instance.StartPoint.Y + instance.BoxW + 100));
746
                            }
747
                            break;
748
                        case MarkupToPDF.Controls.Common.ControlType.TextBorder:
749
                            {
750
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
751
                                rect = new Rect(new Point(instance.StartPoint.X - 100, instance.StartPoint.Y - 100), new Point(instance.StartPoint.X + instance.BoxW + 100, instance.StartPoint.Y + instance.BoxW + 100));
752
                            }
753
                            break;
754
                        case MarkupToPDF.Controls.Common.ControlType.TextCloud:
755
                            {
756
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
757
                                rect = new Rect(new Point(instance.StartPoint.X - 100, instance.StartPoint.Y - 100), new Point(instance.StartPoint.X + instance.BoxW + 100, instance.StartPoint.Y + instance.BoxW + 100));
758
                            }
759
                            break;
760
                        case MarkupToPDF.Controls.Common.ControlType.PolygonControl:
761
                            {
762
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
763

    
764
                                foreach (Point A in instance.PointSet)
765
                                {
766
                                    if (s_point == new Point())
767
                                    {
768
                                        s_point = A;
769
                                        e_point = A;
770
                                    }
771
                                    s_point.X = Math.Min(s_point.X, A.X);
772
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
773
                                    e_point.X = Math.Max(e_point.X, A.X);
774
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
775
                                }
776
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
777
                            }
778
                            break;
779
                        case MarkupToPDF.Controls.Common.ControlType.PolygonCloud:
780
                            {
781
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
782

    
783
                                foreach (Point A in instance.PointSet)
784
                                {
785
                                    if (s_point == new Point())
786
                                    {
787
                                        s_point = A;
788
                                        e_point = A;
789
                                    }
790
                                    s_point.X = Math.Min(s_point.X, A.X);
791
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
792
                                    e_point.X = Math.Max(e_point.X, A.X);
793
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
794
                                }
795
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
796
                            }
797
                            break;
798
                        case MarkupToPDF.Controls.Common.ControlType.ChainLine:
799
                            {
800
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
801

    
802
                                foreach (Point A in instance.PointSet)
803
                                {
804
                                    if (s_point == new Point())
805
                                    {
806
                                        s_point = A;
807
                                        e_point = A;
808
                                    }
809
                                    s_point.X = Math.Min(s_point.X, A.X);
810
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
811
                                    e_point.X = Math.Max(e_point.X, A.X);
812
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
813
                                }
814
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
815
                            }
816
                            break;
817
                        case MarkupToPDF.Controls.Common.ControlType.Ink:
818
                            {
819
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
820

    
821
                                foreach (Point A in instance.PointSet)
822
                                {
823
                                    if (s_point == new Point())
824
                                    {
825
                                        s_point = A;
826
                                        e_point = A;
827
                                    }
828
                                    s_point.X = Math.Min(s_point.X, A.X);
829
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
830
                                    e_point.X = Math.Max(e_point.X, A.X);
831
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
832
                                }
833
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
834
                            }
835
                            break;
836
                        default:
837
                            MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
838
                            rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100));
839
                            break;
840
                    }
841

    
842
                    SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>());
843
                    this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
844
                }
845
                catch (Exception ex)
846
                {
847
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
848
                }
849
            }
850
        }
851

    
852

    
853
        private void btGotoMarkup_Click(object sender, RoutedEventArgs e)
854
        {
855
            var clickButtonItem = sender as RadButton;
856
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
857
            {
858
                try
859
                {
860
             
861

    
862
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
863
                    MarkupList.SelectedItem = gaza;
864

    
865
                    MarkupHelper.GotoMarkup(new[] { gaza.Id });
866
                }
867
                catch (Exception ex)
868
                {
869
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
870
                }
871
            }
872
        }
873

    
874
        ///// <summary>
875
        ///// 선택된 마크업의 ID리스트를 받아 해당 페이지로 이동 후 GotoSelectedMarkup 호출
876
        ///// </summary>
877
        ///// <param name="CommentIdList"></param>
878
        //private void GotoMarkup(IEnumerable<string> CommentIdList)
879
        //{
880
        //    var instance = Common.ViewerDataModel.Instance;
881

    
882
        //    SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
883

    
884
        //    var commentList = instance._markupInfoList.Where(x => x.MarkupList != null).SelectMany(x => x.MarkupList).Where(f => f.ID == CommentIdList.First());
885

    
886
        //    if (commentList.Count() > 0)
887
        //    {
888
        //        //하단 그리드의 markup list에서 commentid가 포함된 markupinfo를 선택되게 한다.
889
        //        #region markup list grid select items
890

    
891
        //        var infoItem = instance._markupInfoList.Where(x => x.MarkupList != null).Where(f => f.MarkupList.Count(y => y == commentList.First()) > 0);
892

    
893
        //        if (infoItem.Count() > 0)
894
        //        {
895

    
896
        //            var gridMarkup = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup;
897
        //            gridMarkup.SelectedItems.Clear();
898
        //            gridMarkup.SelectedItems.Add(infoItem.First());
899
        //        }
900

    
901
        //        #endregion
902

    
903
        //        var pageNavigator = instance.SystemMain.dzMainMenu.pageNavigator;
904

    
905
        //        if (pageNavigator.CurrentPage.PageNumber == commentList.First().PageNumber)
906
        //        {
907
        //            GotoSelectedMarkup(CommentIdList);
908
        //        }
909
        //        else
910
        //        {
911
        //            EventHandler<Sample.PageChangeEventArgs> handler = null;
912

    
913
        //            handler = (snd, evt) =>
914
        //            {
915
        //                GotoSelectedMarkup(CommentIdList);
916
        //                pageNavigator.PageChanged -= handler;
917
        //            };
918

    
919
        //            pageNavigator.PageChanged += handler;
920

    
921
        //            pageNavigator.GotoPage(commentList.First().PageNumber);
922
        //        }
923
        //    }
924
        //}
925

    
926
        ///// <summary>
927
        ///// 페이지 이동 후 마크업을 선택하고 Zoom을 한다.
928
        ///// 마크업이 페이지보다 크면 Zoom을 하지 않음.
929
        ///// </summary>
930
        ///// <param name="CommentIdList"></param>
931
        //private void GotoSelectedMarkup(IEnumerable<string> CommentIdList)
932
        //{
933
        //    var instance = Common.ViewerDataModel.Instance;
934

    
935
        //    var selectOrderComments = instance.MarkupControls.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
936
        //    var commentUserInfo = instance.MarkupControls_USER.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
937

    
938
        //    if (commentUserInfo.Count() > 0 || selectOrderComments.Count() > 0)
939
        //    {
940
        //        commentUserInfo.ForEach(x => x.IsSelected = true);
941
        //        commentUserInfo.AddRange(selectOrderComments);
942

    
943
        //        if (commentUserInfo?.Count() > 0)
944
        //        {
945
        //            var main = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
946

    
947
        //            try
948
        //            {
949
        //                if(Common.ViewerDataModel.Instance.Angle != 0)
950
        //                {
951
        //                    for (int i = 0; i < (Common.ViewerDataModel.Instance.Angle / 90); i++)
952
        //                    {
953
        //                        Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.drawingPannelRotate(true);
954
        //                    } 
955
                            
956
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle = 0;
957
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.X = 0;
958
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.Y = 0;
959
        //                }
960

    
961
        //                Rect rect = commentUserInfo.First().ItemRect;
962

    
963
        //                foreach (var UserInfo in commentUserInfo)
964
        //                {
965
        //                    rect = Rect.Union(rect, UserInfo.ItemRect);
966
        //                }
967

    
968
        //                SelectionSet.Instance.SelectItemByRect(rect, main);
969

    
970
        //                var center = new Vector(Common.ViewerDataModel.Instance.ImageViewWidth / 2, Common.ViewerDataModel.Instance.ImageViewHeight / 2);
971
        //                //var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
972
        //                //rect.Transform(matrix);
973

    
974
        //                double scaleX = Common.ViewerDataModel.Instance.ImageViewWidth / rect.Width;
975
        //                double scaleY = Common.ViewerDataModel.Instance.ImageViewHeight / rect.Height;
976
        //                double newScale = main.zoomAndPanControl.ContentScale * Math.Min(scaleX, scaleY);
977
        //                double positionX = 0;
978
        //                double positionY = 0;
979

    
980
        //                if (Common.ViewerDataModel.Instance.Angle == 90)
981
        //                {
982
        //                    positionX = Common.ViewerDataModel.Instance.ImageViewHeight + rect.X;
983
        //                    positionY = Common.ViewerDataModel.Instance.ImageViewWidth + rect.Y;
984
        //                }
985

    
986
        //                main.zoomAndPanControl.ContentScale = newScale;
987
        //                main.zoomAndPanControl.ContentOffsetX = positionX;
988
        //                main.zoomAndPanControl.ContentOffsetY = positionY;
989

    
990
              
991
        //                var pageSize = new Size(main.pageNavigator.CurrentPage.Width, main.pageNavigator.CurrentPage.Height);
992

    
993
        //                double pageAngle = Common.ViewerDataModel.Instance.Angle;
994

    
995
        //                if (pageAngle == 90)
996
        //                {
997
        //                    pageAngle = 270;
998
        //                }
999
        //                else
1000
        //                {
1001
        //                    pageAngle = 90;
1002
        //                }
1003

    
1004
        //                if ((rect.Size.Width + rect.Size.Height) > (pageSize.Width + pageSize.Height))
1005
        //                {
1006
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1007
        //                    rect.Transform(matrix);
1008

    
1009
        //                    main.zoomAndPanControl.ZoomTo(rect);
1010
        //                }
1011
        //                else
1012
        //                {
1013
        //                    rect.Inflate(rect.Width * 3, rect.Height * 3);
1014

    
1015
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1016
        //                    rect.Transform(matrix);
1017

    
1018

    
1019
        //                    main.zoomAndPanControl.ZoomTo(rect);
1020
        //                }
1021
        //            }
1022
        //            catch (Exception ex)
1023
        //            {
1024
        //                main.DialogMessage_Alert(ex.Message, "Error");
1025
        //            }
1026
        //        }
1027
        //    }
1028
        //}
1029

    
1030
        private void MarkupList_Loaded(object sender, RoutedEventArgs e)
1031
        {
1032
            if (MarkupInfoSmallList.Count == 0)
1033
            {
1034
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
1035
                {
1036
                    if (d.MarkupList != null)
1037
                    {
1038
                        d.MarkupList.ForEach(b =>
1039
                        {
1040
                            bool isConsolidate = false;
1041

    
1042
                            if(d.Consolidate == 1 && d.AvoidConsolidate == 0)
1043
                            {
1044
                                isConsolidate = true;
1045
                            }
1046

    
1047
                            System.Diagnostics.Debug.WriteLine($"UserID : {d.UserID} Consolidate : {d.Consolidate}  AvoidConsolidate : {d.AvoidConsolidate}");
1048

    
1049
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1050
                            {
1051
                                Id = b.ID,
1052
                                Data = b.Data,
1053
                                Data_Type = b.Data_Type,
1054
                                PageNumber = b.PageNumber,
1055
                                UserID = d.UserID,
1056
                                UserName = d.UserName,
1057
                                IsConsolidate = isConsolidate
1058

    
1059
                            });
1060
                        });
1061
                    }
1062
                });
1063
                MarkupList.ItemsSource = null;
1064
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1065

    
1066
                commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
1067
                commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1068
            }
1069
        }
1070

    
1071
        public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item)
1072
        {
1073
            if (MarkupInfoSmallList.Count == 0)
1074
            {
1075
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
1076
                {
1077
                    if (d.MarkupList != null)
1078
                    {
1079
                        d.MarkupList.ForEach(b =>
1080
                        {
1081
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1082
                            {
1083
                                Id = b.ID,
1084
                                Data = b.Data,
1085
                                Data_Type = b.Data_Type,
1086
                                PageNumber = b.PageNumber,
1087
                                UserID = d.UserID,
1088
                                UserName = d.UserName,
1089
                            });
1090
                        });
1091
                    }
1092
                });
1093
                MarkupList.ItemsSource = null;
1094
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1095
                commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
1096
                commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1097
            }
1098

    
1099
            switch (eventType)
1100
            {
1101
                case Event_Type.Create:
1102
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1103
                    {
1104
                        Id = res.CommentID,
1105
                        Data = res.ConvertData,
1106
                        Data_Type = res.DATA_TYPE,
1107
                        PageNumber = CurrentPage.PageNumber,
1108
                        UserID = App.ViewInfo.UserID,
1109
                        UserName = App.UserName,
1110
                    });
1111
                    break;
1112
                case Event_Type.Delete:
1113
                    if(CommentID == null) //user information list delete btn
1114
                    {
1115
                        foreach (var delItem in item.MarkupList)
1116
                        {
1117
                            MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID);
1118
                        }
1119
                    }
1120
                    else //delete, cut, 
1121
                    {
1122
                        MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID));
1123
                    }                    
1124
                    break;
1125
                case Event_Type.Thumb://이동 회전
1126
                    MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID));
1127
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1128
                    {
1129
                        Id = res.CommentID,
1130
                        Data = res.ConvertData,
1131
                        Data_Type = res.DATA_TYPE,
1132
                        PageNumber = CurrentPage.PageNumber,
1133
                        UserID = App.ViewInfo.UserID,
1134
                        UserName = App.UserName,
1135
                    });
1136
                    break;
1137
                default:
1138
                    break;
1139
            }
1140

    
1141
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1142

    
1143
            bool IsConsolidation = false;
1144
            string UserId = null;
1145

    
1146
            if (commentUser.SelectedValue != null)
1147
            {
1148
                if (((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName != "Consolidated")
1149
                {
1150
                    UserId = ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName;
1151
                }
1152
                else
1153
                {
1154
                    IsConsolidation = true;
1155
                }
1156
            }
1157

    
1158
            var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue))
1159
                                 .WhereIf(UserId != null, d => d.UserName == ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).ToString())
1160
                                 .WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue));
1161

    
1162
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();            
1163
           
1164
            commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1165
            commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();            
1166
        }
1167

    
1168
        private void commentFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
1169
        {
1170
            MarkupList.ItemsSource = null;
1171
            txtSearch.Text = string.Empty;
1172

    
1173
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1174

    
1175
            bool IsConsolidation = false;
1176
            string UserId = null;
1177

    
1178
            if (commentUser.SelectedValue != null)
1179
            {
1180
                if(((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName != "Consolidated")
1181
                {
1182
                    UserId = ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName;
1183
                }
1184
                else
1185
                {
1186
                    IsConsolidation = true;
1187
                }
1188
            }
1189

    
1190
            var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue))
1191
                                   .WhereIf(UserId != null, d => d.UserName == UserId)
1192
                                   .WhereIf(IsConsolidation,d=>d.IsConsolidate == IsConsolidation)
1193
                                   .WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue));
1194

    
1195
            MarkupList.ItemsSource = filterItems.OrderBy(d => d.PageNumber).ToList();
1196
        }
1197

    
1198
        private void btnPanorama_Click(object sender, RoutedEventArgs e)
1199
        {
1200
            ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow();
1201
        }
1202

    
1203
        private void btnSearch_Click(object sender, RoutedEventArgs e)
1204
        {
1205
            string search_str = txtSearch.Text;
1206

    
1207
            if(string.IsNullOrWhiteSpace(search_str))
1208
            {
1209
                return;
1210
            }
1211

    
1212
            var sel_type = commentType.SelectedItem;
1213
            var sel_user = commentUser.SelectedItem;
1214
            var sel_page = commentPage.SelectedItem;
1215
            List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>();
1216
            List<MarkupInfoItemSmall> list = MarkupInfoSmallList;
1217
            if (sel_page != null)
1218
            {
1219
                list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList();
1220
            }
1221
            if (sel_type != null)
1222
            {
1223
                list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList();
1224
            }
1225
            if (sel_user != null)
1226
            {
1227
                list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList();
1228
            }
1229
            foreach (var item in list)
1230
            {
1231
                var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(item.Data.ToString());
1232

    
1233
                switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString()))
1234
                {
1235
                    case MarkupToPDF.Controls.Common.ControlType.TextControl:
1236
                    case MarkupToPDF.Controls.Common.ControlType.TextBorder:
1237
                    case MarkupToPDF.Controls.Common.ControlType.TextCloud:
1238
                        {
1239
                            MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
1240

    
1241
                            if (!string.IsNullOrWhiteSpace(instance.Text))
1242
                            {
1243
                                if (instance.Text.ToLower().Contains(search_str.ToLower()))
1244
                                {
1245
                                    small_list.Add(item);
1246
                                }
1247
                            }
1248
                        }
1249
                        break;
1250
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl:
1251
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl:
1252
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl:
1253
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl:
1254
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl:
1255
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl:
1256
                        {
1257
                            MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data);
1258

    
1259
                            if (!string.IsNullOrWhiteSpace(instance.ArrowText))
1260
                            {
1261
                                if (instance.ArrowText.Contains(search_str))
1262
                                {
1263
                                    small_list.Add(item);
1264
                                }
1265
                            }
1266
                        }
1267
                        break;
1268
                }
1269
            }
1270

    
1271
            MarkupList.ItemsSource = null;
1272
            MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList();
1273
        }
1274

    
1275
        private void TxtSearch_KeyDown(object sender, KeyEventArgs e)
1276
        {
1277
            if(e.Key == Key.Enter || e.Key == Key.Return)
1278
            {
1279
                btnSearch_Click(sender, new RoutedEventArgs());
1280
            }
1281
        }
1282
    }
1283
}
클립보드 이미지 추가 (최대 크기: 500 MB)