프로젝트

일반

사용자정보

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

markus / KCOM / Controls / Sample.xaml.cs @ 2c629eec

이력 | 보기 | 이력해설 | 다운로드 (57 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(e.AddedItems.Count > 0)
167
            {
168
                var number = (e.AddedItems[0] as KCOM.Common.ThumbnailItem).PageNumber;
169

    
170
                ViewerDataModel.Instance.SystemMain.dzTopMenu._SaveEvent(null, null);   /// save controls
171

    
172
                this.CurrentPage = e.AddedItems[0] as KCOM.Common.ThumbnailItem;
173

    
174
                PageChanging(this, new PageChangeEventArgs
175
                {
176
                    CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == number).First(),
177
                    PageNumber = number,
178
                    PageUri = null
179
                });
180
            }
181
            
182

    
183
            //if (ImgListbox.SelectedItem != null)
184
            //{
185
            //    int _CurrentPageNo = -1;
186
            //    if (this.CurrentPage != null)
187
            //    {
188
            //        ViewerDataModel.Instance.SystemMain.dzTopMenu._SaveEvent(null, null);   /// save controls
189

    
190
            //        _CurrentPageNo = this.CurrentPage.PageNumber;
191
            //    }
192

    
193
            //    this.CurrentPage = ImgListbox.SelectedItem as ThumbnailItem;
194
            //    int iPageNo = this.CurrentPage.PageNumber;
195
            //    if(_CurrentPageNo != iPageNo)
196
            //    {
197
            //        PageChanging(this, new PageChangeEventArgs
198
            //        {
199
            //            CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(),
200
            //            PageNumber = iPageNo,
201
            //            PageUri = null
202
            //        });
203
            //    }
204
            //}
205

    
206
            //var border = VisualTreeHelper.GetChild(ImgListbox, 0);
207
            //if (border != null)
208
            //{
209
            //    IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>();
210

    
211
            //}
212
            //ScrollViewer scrollViewer = (sender as RadListBox) as ScrollViewer;
213

    
214
            
215
            //System.Diagnostics.Debug.WriteLine("page:"+ImgListbox.SelectedIndex);
216
        }
217

    
218
        public bool GotoPageFlag = false;
219

    
220
        /// <summary>
221
        /// 해당 썸네일로 이동
222
        /// </summary>
223
        /// <param name="_pageNumber">이동할 페이지 번호</param>
224
        public void GotoPage(int _pageNumber)
225
        {
226
            try
227
            {
228
                System.Threading.Tasks.Task.Factory.StartNew(() => { 
229

    
230
                    var _page = _thumbnailItems.Where(item => item.PageNumber == _pageNumber);
231
                    if (_page.Count() > 0)
232
                    {
233
                        ThumbnailItem thumbnailitem = _page.First();
234
                        if (PageChanging != null)
235
                        {
236

    
237
                            ImgListbox.Dispatcher.InvokeAsync(() => {  
238
                                var _itemIndex = this._thumbnailItems.IndexOf(thumbnailitem);
239
                                ImgListbox.SelectedItem = thumbnailitem;
240
                            });
241
                            //ImgListbox.Items.MoveCurrentTo(thumbnailitem);
242
                            //if (_itemIndex < _thumbnailItems.Count() - 1)
243
                            //    ImgListbox.ScrollIntoView(_itemIndex);
244
                            //else
245
                            //    ImgListbox.ScrollIntoView(this._thumbnailItems.Count() - 1);
246
                        }
247
                    }
248

    
249
                }).ConfigureAwait(true);
250
            }
251
            catch(Exception ex)
252
            {
253
                Logger.sendResLog("GotoPage", ex.Message, 0);
254
            }
255
        }
256

    
257
        /// <summary>
258
        /// 주어진 페이지로 변경한다
259
        /// </summary>
260
        /// <param name="iPageNo">변경할 페이지 번호</param>
261
        public void ChangePage(int iPageNo)
262
        {
263
            var thumbitem = this._thumbnailItems.Where(item => item.PageNumber == iPageNo).FirstOrDefault();
264
            if ((PageChanged != null) && (thumbitem != null))
265
            {
266
                var uri = thumbitem.PageUri.ToString();
267
                    //_DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString());
268

    
269
                var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber).FirstOrDefault();
270
                if (_DocPages != null)
271
                {
272
                    PageChanged(this, new PageChangeEventArgs
273
                    {
274
                        CurrentPage = _DocPages,
275
                        PageUri = uri,
276
                        PageNumber = thumbitem.PageNumber
277
                    });
278
                    //ImgListbox.SelectedItem = thumbitem;                    
279
                    //ImgListbox.Items.MoveCurrentTo(thumbitem);
280
                    
281
                    this.CurrentPage = thumbitem;
282
                }
283
                else
284
                {
285
                    //System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다");
286
                }
287
            }
288
        }
289

    
290
        public void GotoPageTALK(int _pageNumber, int _angle)
291
        {
292
            int _PageNo = -1;
293

    
294
            if (int.TryParse(_pageNumber.ToString(), out _PageNo))
295
            {
296
                var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo);
297
                if (_page.Count() > 0)
298
                {
299
                    ThumbnailItem _item = _page.First();
300
                    setPageChangeTALK(_item, _angle);
301
                    this.ImgListbox.SelectedIndex = _pageNumber - 1;
302
                    //this.ImgListbox.ScrollIntoView(_pageNumber - 1);
303
                }
304
            }
305
        }
306

    
307
        public void setPageChangeTALK(ThumbnailItem thumbnailItem, int _angle)
308
        {
309
            if (thumbnailItem != null)
310
            {
311
                if (PageChanging != null)
312
                {
313
                    ///this.CurrentPage = _NextPage;
314
                    ///_NextPage = thumbnailItem;
315
                    PageChanging(this, new PageChangeEventArgs
316
                    {
317
                        CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(),
318
                        PageNumber = Convert.ToInt32(thumbnailItem.PageNumber),
319
                        PageUri = null
320
                    });
321

    
322
                    var instanceMain = this.ParentOfType<MainWindow>();
323

    
324
                    var rotationNum = (_angle - instanceMain.dzMainMenu.rotate.Angle) / 90;
325

    
326
                    if (rotationNum > 0) // 1, 2, 3
327
                    {
328
                        for (int i = 0; i < rotationNum; i++)
329
                        {
330
                            drawingPannelRotate(true);
331
                        }
332
                    }
333
                    else if (rotationNum < 0)// -1, -2, -3
334
                    {
335
                        for (int i = 0; i < -rotationNum; i++)
336
                        {
337
                            drawingPannelRotate(false);
338
                        }
339
                    }
340
                }
341
            }
342
        }
343

    
344
        public void drawingPannelRotate(bool Flag)
345
        {
346
            var instanceMain = this.ParentOfType<MainWindow>();
347

    
348
            if (Flag)
349
            {
350
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
351
                {
352
                    instanceMain.dzMainMenu.rotate.Angle = 0;
353
                }
354
                else
355
                {
356
                    instanceMain.dzMainMenu.rotate.Angle += 90;
357
                }
358
            }
359
            else
360
            {
361
                if (instanceMain.dzMainMenu.rotate.Angle == 0)
362
                {
363
                    instanceMain.dzMainMenu.rotate.Angle = 270;
364
                }
365
                else
366
                {
367
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
368
                }
369
            }
370

    
371
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
372
            {
373
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
374
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
375
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
376
            }
377

    
378
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
379
            {
380
                instanceMain.dzMainMenu.translate.X = 0;
381
                instanceMain.dzMainMenu.translate.Y = 0;
382
            }
383
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
384
            {
385
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
386
                instanceMain.dzMainMenu.translate.Y = 0;
387
            }
388
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
389
            {
390
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
391
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
392
            }
393
            else
394
            {
395
                instanceMain.dzMainMenu.translate.X = 0;
396
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
397
            }
398

    
399
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
400
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
401
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
402
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
403
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
404
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
405

    
406
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
407
            {
408
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
409

    
410
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
411
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
412
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
413

    
414
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
415
                if (rotationdoc != null)
416
                {
417
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
418
                }
419
                else
420
                {
421
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
422
                }
423
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
424
            });
425
        }
426

    
427
        void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
428
        {
429
            SetCommentPages();
430
        }
431
        
432
        void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
433
        {
434
            SetCommentPages();
435
            //System.Diagnostics.Debug.WriteLine(e.PropertyName);
436
        }
437

    
438
        public void SetCommentPages()
439
        {
440
            ThumbnailSet();
441
            SetCommentList(UsersCommentPagesList.ToList());
442
        }
443

    
444
        public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList)
445
        {
446
            Logger.sendCheckLog("SetCommentList", 1);
447
            Logger.sendCheckLog("SetCommentList_기존 Comment 색상 제거", 1);
448
            #region 기존 색상 제거 작업
449
            foreach (var item in this._thumbnailItems)
450
            {
451
                item.DisplayColorItems.Clear();
452
            }
453
            #endregion
454

    
455
            Logger.sendCheckLog("SetCommentList_delItem select 및 remove", 1);
456
            List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>();
457

    
458
            this.UsersCommentPagesList.ToList().ForEach(item =>
459
            {
460
                var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID);
461

    
462
                if (_comm.Count() == 0)
463
                {
464
                    _delItem.Add(item);
465
                }
466
            });
467

    
468
            _delItem.ForEach(f => this.UsersCommentPagesList.Remove(f));
469

    
470
            Logger.sendCheckLog("SetCommentList_UsersCommentPagesMember_PropertyChanged", 1);
471
            List<SetColorMarkupItem> setColorMarkupItems = new List<SetColorMarkupItem>();
472

    
473
            UsersCommentPagesList.ForEach(user =>
474
            {
475
                user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
476
                user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
477

    
478
                var _commLst = this.UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID);
479

    
480
                if (_commLst.Count() == 0)
481
                {
482
                    this.UsersCommentPagesList.Add(user);
483
                }
484
                else
485
                {
486
                    if (_commLst.First().PageNumber != user.PageNumber)
487
                        _commLst.First().PageNumber = user.PageNumber;
488
                }
489

    
490
                user.PageNumber.ForEach(page =>
491
                {
492
                    var _items = this._thumbnailItems.Where(item => item.PageNumber == page);
493

    
494
                    if (_items.Count() > 0)
495
                    {
496
                        setColorMarkupItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor, markupID = user.MarkupInfoID, Page = page });
497
                        
498
                    }
499
                        
500
                });
501
            });
502

    
503
            foreach (var item in this._thumbnailItems)
504
            {
505
                item.DisplayColorItems = setColorMarkupItems.Where(color => color.Page == item.PageNumber).ToList();
506
            }
507
            
508
            Logger.sendCheckLog("SetCommentList_SelectComment.ItemsSource 설정", 1);
509
            var data = UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList();
510
            if (data.Count() != 0)
511
            {
512
                if (Convert.ToBoolean(data.First().isConSolidation))
513
                {
514
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated";
515
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = "";
516
                    this.lstSelectComment.ItemsSource = data;
517
                }
518
                else
519
                {
520
                    this.lstSelectComment.ItemsSource = this.UsersCommentPagesList;  //섬네일   
521
                }
522
            }
523
            else
524
            {
525
                this.lstSelectComment.ItemsSource = this.UsersCommentPagesList;  //섬네일   
526
            }
527

    
528
            Logger.sendCheckLog("SetComme6ntList_ImgListbox 설정", 1);
529

    
530

    
531
            //var template = this.ImgListbox.ItemTemplate;
532
            //this.ImgListbox.ItemTemplate = null;
533
            //this.ImgListbox.ItemTemplate = template;
534

    
535
        }
536

    
537
        private void ThumbnailSet()
538
        {
539
            Logger.sendCheckLog("ThumbnailSet", 1);
540
            if (!_Initialize) return;
541

    
542
            this._thumbnailItems = new ObservableCollection<ThumbnailItem>();
543
            List<int> _selectComment = new List<int>();
544
            if (this.lstSelectComment.ItemsSource != null)
545
            {
546
                var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>()
547
                             where commentPage.IsSelected == true
548
                             select commentPage.PageNumber;
549

    
550
                foreach (var item in _pages)
551
                {
552
                    item.ForEach(pp => _selectComment.Add(pp));
553
                }
554

    
555
                _selectComment.Distinct();
556
            }
557

    
558
            var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0");
559
            this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList();
560
            //this._PageList.ForEach(page =>
561
            ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page =>
562
            {
563
                var _pageNo = page.PAGE_NUMBER;
564
                bool _addFlag = false;
565

    
566
                if (rdoFavoritePages.IsChecked == false)
567
                {
568
                    if (_selectComment.Count() > 0)
569
                    {
570
                        if ((rdoAllPages.IsChecked == true)
571
                            || (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0))
572
                        {
573
                            _addFlag = true;
574
                        }
575
                    }
576
                    else
577
                    {
578
                        //if (App.ViewInfo.IsCustomPage)
579
                        //{
580
                        //    //_addFlag = false;
581

    
582
                        //    //App.ViewInfo.IsCustomPage = false;
583
                        //    //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed;
584
                        //    //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed;
585
                        //    this.rdoAllPages.IsChecked = false;
586
                        //    this.rdoFavoritePages.IsChecked = true;
587
                        //    //SetCommentPages();                        
588
                        //}
589
                        //else
590
                        //{
591
                        _addFlag = true;
592
                        //}
593
                    }
594
                }
595

    
596

    
597
                if (_addFlag)
598
                {
599
                    this._thumbnailItems.Add(new ThumbnailItem
600
                    {
601
                        ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
602
                        PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")),
603
                        PageNumber = _pageNo,
604
                        Angle = page.PAGE_ANGLE,
605
                    });
606
                }
607
                else
608
                {
609
                    if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null)
610
                    {
611
                        this._thumbnailItems.Add(new ThumbnailItem
612
                        {
613
                            ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
614
                            PageNumber = _pageNo,
615
                            Angle = page.PAGE_ANGLE,
616
                        });
617
                    }
618
                }
619

    
620

    
621

    
622
                //this._thumbnailItems.Add(new ThumbnailItem
623
                //{
624
                //    ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
625

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

    
628
                //    //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"),
629
                //    //DisplayColorItems = pageColor,
630
                //    PageNumber = Convert.ToInt32(_pageNo),
631
                //    Angle = Convert.ToInt32(page.PAGE_ANGLE),
632
                //});
633
            });
634

    
635
            //txtTotPageNo.Text = this._PageList.Count().ToString();
636

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

    
639
            if (ImgListbox.ItemsSource == null)
640
            {
641
                ImgListbox.ItemsSource = this._thumbnailItems;
642

    
643
                this._thumbnailItems.ToList().ForEach(data =>
644
                {
645
                    data.Width = ImgListbox.ActualWidth;
646
                    data.Height = ImgListbox.ActualHeight;
647
                });
648

    
649
                if (ImgListbox.Items.Count > 0)
650
                {
651
                    //int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1;
652
                    int StartPageIdx = 1;
653
                    //if (App.ViewInfo.IsCustomPage)
654
                    //{
655
                    //    ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault();
656
                    //}
657
                    //else
658
                    //{
659

    
660
                    if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1)
661
                    {
662
                        ImgListbox.SelectedItem = ImgListbox.Items[0];
663
                    }
664
                    else
665
                    {
666
                        ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx];
667
                    }
668
                    //}
669
                }
670
            }
671
            else
672
            {
673
                ImgListbox.UpdateLayout();
674
                ImgListbox.ItemsSource = this._thumbnailItems;
675
            }
676
        }
677

    
678
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
679
        {
680
            if (e.ClickCount >= 2)
681
            {
682
                var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem;
683
                GotoPage(selectItem.PageNumber);
684
                var result = MarkupParser.GetBaseControl(selectItem.Data);
685
                Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100));
686
                this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
687
                //bool isGO = false;
688

    
689
                //var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer;
690
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
691
                //imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle;
692
                //imageViewer.InteractiveUserRectangle += (sen, ea) =>
693
                //{
694
                //    System.Diagnostics.Debug.WriteLine(ea.Bounds);
695
                //    if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End)
696
                //    {
697
                //        this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds);                        
698
                //    }
699

    
700
                //};
701
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal;
702

    
703
                //GotoPage(MarkupList.SelectedItem as MarkupList)
704
            }
705
        }
706

    
707
        public class MarkupInfoItemSmall
708
        {
709
            public string Id { get; set; }
710
            public string UserName { get; set; }
711
            public string UserID { get; set; }
712
            public int PageNumber { get; set; }
713
            public string Data { get; set; }
714
            public int Data_Type { get; set; }
715
            public bool IsConsolidate { get; set; }
716
        }
717

    
718
        private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; }
719
        public List<MarkupInfoItemSmall> MarkupInfoSmallList
720
        {
721
            get
722
            {
723
                if (_MarkupInfoSmallList == null)
724
                {
725
                    _MarkupInfoSmallList = new List<MarkupInfoItemSmall>();
726
                }
727
                return _MarkupInfoSmallList;
728
            }
729
            set
730
            {
731

    
732
                _MarkupInfoSmallList = value;
733
                RaisePropertyChanged("MarkupInfoSmallList");
734
            }
735
        }
736

    
737
        /// <summary>
738
        /// goto page and select item selected by user
739
        /// </summary>
740
        /// <param name="sender"></param>
741
        /// <param name="e"></param>
742
        private void RadButton_Click_OLD(object sender, RoutedEventArgs e)
743
        {
744
            var clickButtonItem = sender as RadButton;
745
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
746
            {
747
                try
748
                {
749
                    Rect rect = new Rect();
750
                    Point s_point = new Point();
751
                    Point e_point = new Point();
752

    
753
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
754
                    GotoPage(Convert.ToInt32(gaza.PageNumber));
755

    
756
                    var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업
757
                    switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString()))
758
                    {
759
                        case MarkupToPDF.Controls.Common.ControlType.TextControl:
760
                            {
761
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
762
                                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));
763
                            }
764
                            break;
765
                        case MarkupToPDF.Controls.Common.ControlType.TextBorder:
766
                            {
767
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
768
                                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));
769
                            }
770
                            break;
771
                        case MarkupToPDF.Controls.Common.ControlType.TextCloud:
772
                            {
773
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
774
                                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));
775
                            }
776
                            break;
777
                        case MarkupToPDF.Controls.Common.ControlType.PolygonControl:
778
                            {
779
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
780

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

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

    
819
                                foreach (Point A in instance.PointSet)
820
                                {
821
                                    if (s_point == new Point())
822
                                    {
823
                                        s_point = A;
824
                                        e_point = A;
825
                                    }
826
                                    s_point.X = Math.Min(s_point.X, A.X);
827
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
828
                                    e_point.X = Math.Max(e_point.X, A.X);
829
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
830
                                }
831
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
832
                            }
833
                            break;
834
                        case MarkupToPDF.Controls.Common.ControlType.Ink:
835
                            {
836
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
837

    
838
                                foreach (Point A in instance.PointSet)
839
                                {
840
                                    if (s_point == new Point())
841
                                    {
842
                                        s_point = A;
843
                                        e_point = A;
844
                                    }
845
                                    s_point.X = Math.Min(s_point.X, A.X);
846
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
847
                                    e_point.X = Math.Max(e_point.X, A.X);
848
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
849
                                }
850
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
851
                            }
852
                            break;
853
                        default:
854
                            MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
855
                            rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100));
856
                            break;
857
                    }
858

    
859
                    SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>());
860
                    this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
861
                }
862
                catch (Exception ex)
863
                {
864
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
865
                }
866
            }
867
        }
868

    
869

    
870
        private void btGotoMarkup_Click(object sender, RoutedEventArgs e)
871
        {
872
            var clickButtonItem = sender as RadButton;
873
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
874
            {
875
                try
876
                {
877
             
878

    
879
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
880
                    MarkupList.SelectedItem = gaza;
881

    
882
                    MarkupHelper.GotoMarkup(new[] { gaza.Id });
883
                }
884
                catch (Exception ex)
885
                {
886
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
887
                }
888
            }
889
        }
890

    
891
        ///// <summary>
892
        ///// 선택된 마크업의 ID리스트를 받아 해당 페이지로 이동 후 GotoSelectedMarkup 호출
893
        ///// </summary>
894
        ///// <param name="CommentIdList"></param>
895
        //private void GotoMarkup(IEnumerable<string> CommentIdList)
896
        //{
897
        //    var instance = Common.ViewerDataModel.Instance;
898

    
899
        //    SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
900

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

    
903
        //    if (commentList.Count() > 0)
904
        //    {
905
        //        //하단 그리드의 markup list에서 commentid가 포함된 markupinfo를 선택되게 한다.
906
        //        #region markup list grid select items
907

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

    
910
        //        if (infoItem.Count() > 0)
911
        //        {
912

    
913
        //            var gridMarkup = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup;
914
        //            gridMarkup.SelectedItems.Clear();
915
        //            gridMarkup.SelectedItems.Add(infoItem.First());
916
        //        }
917

    
918
        //        #endregion
919

    
920
        //        var pageNavigator = instance.SystemMain.dzMainMenu.pageNavigator;
921

    
922
        //        if (pageNavigator.CurrentPage.PageNumber == commentList.First().PageNumber)
923
        //        {
924
        //            GotoSelectedMarkup(CommentIdList);
925
        //        }
926
        //        else
927
        //        {
928
        //            EventHandler<Sample.PageChangeEventArgs> handler = null;
929

    
930
        //            handler = (snd, evt) =>
931
        //            {
932
        //                GotoSelectedMarkup(CommentIdList);
933
        //                pageNavigator.PageChanged -= handler;
934
        //            };
935

    
936
        //            pageNavigator.PageChanged += handler;
937

    
938
        //            pageNavigator.GotoPage(commentList.First().PageNumber);
939
        //        }
940
        //    }
941
        //}
942

    
943
        ///// <summary>
944
        ///// 페이지 이동 후 마크업을 선택하고 Zoom을 한다.
945
        ///// 마크업이 페이지보다 크면 Zoom을 하지 않음.
946
        ///// </summary>
947
        ///// <param name="CommentIdList"></param>
948
        //private void GotoSelectedMarkup(IEnumerable<string> CommentIdList)
949
        //{
950
        //    var instance = Common.ViewerDataModel.Instance;
951

    
952
        //    var selectOrderComments = instance.MarkupControls.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
953
        //    var commentUserInfo = instance.MarkupControls_USER.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
954

    
955
        //    if (commentUserInfo.Count() > 0 || selectOrderComments.Count() > 0)
956
        //    {
957
        //        commentUserInfo.ForEach(x => x.IsSelected = true);
958
        //        commentUserInfo.AddRange(selectOrderComments);
959

    
960
        //        if (commentUserInfo?.Count() > 0)
961
        //        {
962
        //            var main = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
963

    
964
        //            try
965
        //            {
966
        //                if(Common.ViewerDataModel.Instance.Angle != 0)
967
        //                {
968
        //                    for (int i = 0; i < (Common.ViewerDataModel.Instance.Angle / 90); i++)
969
        //                    {
970
        //                        Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.drawingPannelRotate(true);
971
        //                    } 
972
                            
973
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle = 0;
974
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.X = 0;
975
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.Y = 0;
976
        //                }
977

    
978
        //                Rect rect = commentUserInfo.First().ItemRect;
979

    
980
        //                foreach (var UserInfo in commentUserInfo)
981
        //                {
982
        //                    rect = Rect.Union(rect, UserInfo.ItemRect);
983
        //                }
984

    
985
        //                SelectionSet.Instance.SelectItemByRect(rect, main);
986

    
987
        //                var center = new Vector(Common.ViewerDataModel.Instance.ImageViewWidth / 2, Common.ViewerDataModel.Instance.ImageViewHeight / 2);
988
        //                //var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
989
        //                //rect.Transform(matrix);
990

    
991
        //                double scaleX = Common.ViewerDataModel.Instance.ImageViewWidth / rect.Width;
992
        //                double scaleY = Common.ViewerDataModel.Instance.ImageViewHeight / rect.Height;
993
        //                double newScale = main.zoomAndPanControl.ContentScale * Math.Min(scaleX, scaleY);
994
        //                double positionX = 0;
995
        //                double positionY = 0;
996

    
997
        //                if (Common.ViewerDataModel.Instance.Angle == 90)
998
        //                {
999
        //                    positionX = Common.ViewerDataModel.Instance.ImageViewHeight + rect.X;
1000
        //                    positionY = Common.ViewerDataModel.Instance.ImageViewWidth + rect.Y;
1001
        //                }
1002

    
1003
        //                main.zoomAndPanControl.ContentScale = newScale;
1004
        //                main.zoomAndPanControl.ContentOffsetX = positionX;
1005
        //                main.zoomAndPanControl.ContentOffsetY = positionY;
1006

    
1007
              
1008
        //                var pageSize = new Size(main.pageNavigator.CurrentPage.Width, main.pageNavigator.CurrentPage.Height);
1009

    
1010
        //                double pageAngle = Common.ViewerDataModel.Instance.Angle;
1011

    
1012
        //                if (pageAngle == 90)
1013
        //                {
1014
        //                    pageAngle = 270;
1015
        //                }
1016
        //                else
1017
        //                {
1018
        //                    pageAngle = 90;
1019
        //                }
1020

    
1021
        //                if ((rect.Size.Width + rect.Size.Height) > (pageSize.Width + pageSize.Height))
1022
        //                {
1023
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1024
        //                    rect.Transform(matrix);
1025

    
1026
        //                    main.zoomAndPanControl.ZoomTo(rect);
1027
        //                }
1028
        //                else
1029
        //                {
1030
        //                    rect.Inflate(rect.Width * 3, rect.Height * 3);
1031

    
1032
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1033
        //                    rect.Transform(matrix);
1034

    
1035

    
1036
        //                    main.zoomAndPanControl.ZoomTo(rect);
1037
        //                }
1038
        //            }
1039
        //            catch (Exception ex)
1040
        //            {
1041
        //                main.DialogMessage_Alert(ex.Message, "Error");
1042
        //            }
1043
        //        }
1044
        //    }
1045
        //}
1046

    
1047
        private void MarkupList_Loaded(object sender, RoutedEventArgs e)
1048
        {
1049
            if (MarkupInfoSmallList.Count == 0)
1050
            {
1051
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
1052
                {
1053
                    if (d.MarkupList != null)
1054
                    {
1055
                        d.MarkupList.ForEach(b =>
1056
                        {
1057
                            bool isConsolidate = false;
1058

    
1059
                            if(d.Consolidate == 1 && d.AvoidConsolidate == 0)
1060
                            {
1061
                                isConsolidate = true;
1062
                            }
1063

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

    
1066
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1067
                            {
1068
                                Id = b.ID,
1069
                                Data = b.Data,
1070
                                Data_Type = b.Data_Type,
1071
                                PageNumber = b.PageNumber,
1072
                                UserID = d.UserID,
1073
                                UserName = d.UserName,
1074
                                IsConsolidate = isConsolidate
1075

    
1076
                            });
1077
                        });
1078
                    }
1079
                });
1080
                MarkupList.ItemsSource = null;
1081
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1082

    
1083
                FilterUpdate();
1084
            }
1085
        }
1086

    
1087
        public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item)
1088
        {
1089
            if (MarkupInfoSmallList.Count == 0)
1090
            {
1091
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
1092
                {
1093
                    if (d.MarkupList != null)
1094
                    {
1095
                        d.MarkupList.ForEach(b =>
1096
                        {
1097
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1098
                            {
1099
                                Id = b.ID,
1100
                                Data = b.Data,
1101
                                Data_Type = b.Data_Type,
1102
                                PageNumber = b.PageNumber,
1103
                                UserID = d.UserID,
1104
                                UserName = d.UserName,
1105
                            });
1106
                        });
1107
                    }
1108
                });
1109
                MarkupList.ItemsSource = null;
1110
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1111
            }
1112

    
1113
            switch (eventType)
1114
            {
1115
                case Event_Type.Create:
1116
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1117
                    {
1118
                        Id = res.CommentID,
1119
                        Data = res.ConvertData,
1120
                        Data_Type = res.DATA_TYPE,
1121
                        PageNumber = CurrentPage.PageNumber,
1122
                        UserID = App.ViewInfo.UserID,
1123
                        UserName = App.UserName,
1124
                    });
1125
                    break;
1126
                case Event_Type.Delete:
1127
                    if(CommentID == null) //user information list delete btn
1128
                    {
1129
                        foreach (var delItem in item.MarkupList)
1130
                        {
1131
                            MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID);
1132
                        }
1133
                    }
1134
                    else //delete, cut, 
1135
                    {
1136
                        MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID));
1137
                    }                    
1138
                    break;
1139
                case Event_Type.Thumb://이동 회전
1140
                    MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID));
1141
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1142
                    {
1143
                        Id = res.CommentID,
1144
                        Data = res.ConvertData,
1145
                        Data_Type = res.DATA_TYPE,
1146
                        PageNumber = CurrentPage.PageNumber,
1147
                        UserID = App.ViewInfo.UserID,
1148
                        UserName = App.UserName,
1149
                    });
1150
                    break;
1151
                default:
1152
                    break;
1153
            }
1154

    
1155
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1156

    
1157
            bool IsConsolidation = false;
1158
            string UserId = null;
1159

    
1160
            if (commentUser.SelectedValue != null)
1161
            {
1162
                if (((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName != "Consolidated")
1163
                {
1164
                    UserId = ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).UserName;
1165
                }
1166
                else
1167
                {
1168
                    IsConsolidation = true;
1169
                }
1170
            }
1171

    
1172
            var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue))
1173
                                 .WhereIf(UserId != null, d => d.UserName == ((KCOM.Common.UsersCommentPagesMember)commentUser.SelectedValue).ToString())
1174
                                 .WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue));
1175

    
1176
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1177

    
1178
            FilterUpdate();
1179
        }
1180

    
1181
        private void FilterUpdate(string selectUser = null)
1182
        {
1183
            //var items = MarkupList.ItemsSource as List<MarkupInfoItemSmall>;
1184

    
1185
            //commentType.ItemsSource = items.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1186
            //commentPage.ItemsSource = items.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
1187

    
1188

    
1189
            var items = MarkupList.ItemsSource as List<MarkupInfoItemSmall>;
1190
 
1191
            var filterUsers = MarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue))
1192
                                   .WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue));
1193

    
1194
            var filterTypes = MarkupInfoSmallList.WhereIf(selectUser != null, d => d.UserName == selectUser)
1195
                                .WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue));
1196

    
1197
            var filterPages = MarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue))
1198
                              .WhereIf(selectUser != null, d => d.UserName == selectUser);
1199

    
1200
            commentUser.ItemsSource = filterUsers.Select(d => d.UserName).Distinct().OrderBy(d => d).ToList();
1201
            commentType.ItemsSource = filterTypes.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1202
            commentPage.ItemsSource = filterPages.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
1203
        }
1204

    
1205
        
1206

    
1207
        private void commentFilter_SelectionChanged(object sender, SelectionChangedEventArgs e)
1208
        {
1209
            MarkupList.ItemsSource = null;
1210
            txtSearch.Text = string.Empty;
1211

    
1212
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1213

    
1214
            bool IsConsolidation = false;
1215
            string userName = null;
1216

    
1217
            if (commentUser.SelectedValue != null)
1218
            {
1219
                if(commentUser.SelectedValue?.ToString() != "Consolidated")
1220
                {
1221
                    userName = commentUser.SelectedValue.ToString();
1222
                }
1223
                else
1224
                {
1225
                    IsConsolidation = true;
1226
                }
1227
            }
1228

    
1229
            var filterItems = TempMarkupInfoSmallList.WhereIf(commentType.SelectedValue != null, d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue))
1230
                                   .WhereIf(userName != null, d => d.UserName == userName)
1231
                                   .WhereIf(IsConsolidation,d=>d.IsConsolidate == IsConsolidation)
1232
                                   .WhereIf(commentPage.SelectedValue != null, d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue));
1233

    
1234
            MarkupList.ItemsSource = filterItems.OrderBy(d => d.PageNumber).ToList();
1235

    
1236
            FilterUpdate();
1237
        }
1238

    
1239
        private void btnPanorama_Click(object sender, RoutedEventArgs e)
1240
        {
1241
            ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow();
1242
        }
1243

    
1244
        private void btnSearch_Click(object sender, RoutedEventArgs e)
1245
        {
1246
            string search_str = txtSearch.Text;
1247

    
1248
            if(string.IsNullOrWhiteSpace(search_str))
1249
            {
1250
                return;
1251
            }
1252

    
1253
            var sel_type = commentType.SelectedItem;
1254
            var sel_user = commentUser.SelectedItem;
1255
            var sel_page = commentPage.SelectedItem;
1256
            List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>();
1257
            List<MarkupInfoItemSmall> list = MarkupInfoSmallList;
1258
            if (sel_page != null)
1259
            {
1260
                list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList();
1261
            }
1262
            if (sel_type != null)
1263
            {
1264
                list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList();
1265
            }
1266
            if (sel_user != null)
1267
            {
1268
                list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList();
1269
            }
1270
            foreach (var item in list)
1271
            {
1272
                var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(item.Data.ToString());
1273

    
1274
                switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString()))
1275
                {
1276
                    case MarkupToPDF.Controls.Common.ControlType.TextControl:
1277
                    case MarkupToPDF.Controls.Common.ControlType.TextBorder:
1278
                    case MarkupToPDF.Controls.Common.ControlType.TextCloud:
1279
                        {
1280
                            MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
1281

    
1282
                            if (!string.IsNullOrWhiteSpace(instance.Text))
1283
                            {
1284
                                if (instance.Text.ToLower().Contains(search_str.ToLower()))
1285
                                {
1286
                                    small_list.Add(item);
1287
                                }
1288
                            }
1289
                        }
1290
                        break;
1291
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl:
1292
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl:
1293
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl:
1294
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl:
1295
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl:
1296
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl:
1297
                        {
1298
                            MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data);
1299

    
1300
                            if (!string.IsNullOrWhiteSpace(instance.ArrowText))
1301
                            {
1302
                                if (instance.ArrowText.Contains(search_str))
1303
                                {
1304
                                    small_list.Add(item);
1305
                                }
1306
                            }
1307
                        }
1308
                        break;
1309
                }
1310
            }
1311

    
1312
            MarkupList.ItemsSource = null;
1313
            MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList();
1314
        }
1315

    
1316
        private void TxtSearch_KeyDown(object sender, KeyEventArgs e)
1317
        {
1318
            if(e.Key == Key.Enter || e.Key == Key.Return)
1319
            {
1320
                btnSearch_Click(sender, new RoutedEventArgs());
1321
            }
1322
        }
1323
    }
1324
}
클립보드 이미지 추가 (최대 크기: 500 MB)