프로젝트

일반

사용자정보

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

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

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

1 787a4489 KangIngu
using IKCOM;
2
using KCOM.Common;
3
using KCOMDataModel.DataModel;
4 4eb052e4 ljiyeon
using MarkupToPDF.Common;
5 5529d2a2 humkyung
using MarkupToPDF.Controls.Parsing;
6 787a4489 KangIngu
using System;
7
using System.Collections.Generic;
8
using System.Collections.ObjectModel;
9
using System.ComponentModel;
10 0c997b99 ljiyeon
using System.Diagnostics;
11 787a4489 KangIngu
using System.Linq;
12
using System.Windows;
13
using System.Windows.Controls;
14
using System.Windows.Input;
15 83a98e96 송근호
using System.Windows.Media;
16 787a4489 KangIngu
using Telerik.Windows.Controls;
17 4eb052e4 ljiyeon
using static MarkupToPDF.Controls.Parsing.MarkupParser;
18 787a4489 KangIngu
19
namespace KCOM.Controls
20
{
21
    /// <summary>
22
    /// Interaction logic for PageNavigator.xaml
23
    /// </summary>
24
    public partial class Sample : UserControl, INotifyPropertyChanged
25
    {
26 992a98b4 KangIngu
        public List<FAVORITE_DOC> _FavoriteSet { get; set; }
27 787a4489 KangIngu
        public event PropertyChangedEventHandler PropertyChanged;
28
        public Sample()
29 39f0624f ljiyeon
        {             
30 e0cfc73c ljiyeon
            App.splashString(ISplashMessage.SAMPLE);
31 0c997b99 ljiyeon
            this.Loaded += Sample_Loaded;
32
        }
33
34
        private void Sample_Loaded(object sender, RoutedEventArgs e)
35
        {
36 afaa7c92 djkim
            if(!_Initialize)
37
            {
38
                InitializeComponent();
39
                _Initialize = true;
40
                this.lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged);
41
                this.ImgListbox.SelectionChanged += new SelectionChangedEventHandler(ImgListbox_SelectionChanged);                
42
            }            
43 787a4489 KangIngu
        }
44
45
        public ObservableCollection<ThumbnailItem> _thumbnailItems;
46
        private List<DOCPAGE> _PageList = null;
47
        private string _DefaultUri = null;
48
        public ThumbnailItem CurrentPage = null;
49
        public int PageCount = 0;
50
        private bool _Initialize;
51
        public event EventHandler<PageChangeEventArgs> PageChanged;
52
        public event EventHandler<PageChangeEventArgs> PageChanging;
53
        List<UsersCommentPagesMember> _UsersCommentPagesList = new List<UsersCommentPagesMember>();
54
        public class PageChangeEventArgs : EventArgs
55
        {
56
            public DOCPAGE CurrentPage { get; set; }
57
            public string PageUri { get; set; }
58
            public int PageNumber { get; set; }
59
        }
60
        private bool _IsFitOn { get; set; }
61
        public bool IsFitOn
62
        {
63
            get
64
            {
65
                return _IsFitOn;
66
            }
67
            set
68
            {
69
                _IsFitOn = value;
70
                RaisePropertyChanged("IsFitOn");
71
            }
72
        }
73
74
        public void RaisePropertyChanged(string propName)
75
        {
76
            if (PropertyChanged != null)
77
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
78
        }
79
80
        public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri)
81
        {
82 548c696e ljiyeon
            Logger.sendCheckLog("SetPageNavi", 1);
83 787a4489 KangIngu
            this._PageList = PageList;
84
            this._DefaultUri = DefaultUri;
85
            ThumbnailSet();
86
            this.PageCount = PageList.Count();
87
            //ThumbNmailSet();
88
            rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked);
89
            rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked);
90
            expCommentPages.PreviewCollapsed += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewCollapsed);
91
            expCommentPages.PreviewExpanded += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewExpanded);
92
        }
93 39f0624f ljiyeon
94 787a4489 KangIngu
        void rdoCommented_Checked(object sender, RoutedEventArgs e)
95
        {
96 548c696e ljiyeon
            Logger.sendCheckLog("rdoCommented_Checked", 1);
97 787a4489 KangIngu
            if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false;
98
            SetCommentPages();
99
        }
100
101
        void rdoFavoritePages_Checked(object sender, RoutedEventArgs e)
102
        {
103 548c696e ljiyeon
            Logger.sendCheckLog("rdoFavoritePages_Checked", 1);
104 992a98b4 KangIngu
            if (rdoFavoritePages.IsChecked == true)
105
                expCommentPages.IsExpanded = false;
106
107 90e7968d ljiyeon
            _FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet;
108 992a98b4 KangIngu
            if (_FavoriteSet.Count > 0)
109
            {
110
                SetCommentPages_Favorite(); //수정    
111
            }
112
            else
113
            {
114
                rdoAllPages.IsChecked = true;
115
                rdoFavoritePages.IsChecked = false;
116
            }
117
        }
118
119
        private void SetCommentPages_Favorite()
120
        {
121 90e7968d ljiyeon
            ThumbnailSet();            
122 992a98b4 KangIngu
            SetCommentPages();
123 787a4489 KangIngu
        }
124 992a98b4 KangIngu
125 787a4489 KangIngu
        void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e)
126
        {
127
            //txtThumbCount.Visibility = Visibility.Collapsed;            
128
        }
129
130
        void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e)
131
        {
132 548c696e ljiyeon
            Logger.sendCheckLog("expCommentPages_PreviewExpanded", 1);
133 787a4489 KangIngu
            rdoAllPages.IsChecked = false;
134
            rdoFavoritePages.IsChecked = false;
135
            //txtThumbCount.Visibility = Visibility.Visible;
136
            SetCommentPages();
137
        }
138
139 129ca191 humkyung
        /// <summary>
140
        /// called when image list box's selection is changed
141
        /// </summary>
142
        /// <param name="sender"></param>
143
        /// <param name="e"></param>
144 787a4489 KangIngu
        private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
145 afaa7c92 djkim
        {            
146 787a4489 KangIngu
            if (ImgListbox.SelectedItem != null)
147
            {
148 3908a575 humkyung
                int _CurrentPageNo = -1;
149 129ca191 humkyung
                if (this.CurrentPage != null)
150
                {
151
                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);   /// save controls
152
                    _CurrentPageNo = this.CurrentPage.PageNumber;
153
                }
154 787a4489 KangIngu
155 129ca191 humkyung
                this.CurrentPage = ImgListbox.SelectedItem as ThumbnailItem;
156
                int iPageNo = this.CurrentPage.PageNumber;
157 3908a575 humkyung
                if(_CurrentPageNo != iPageNo)
158 787a4489 KangIngu
                {
159 3908a575 humkyung
                    PageChanging(this, new PageChangeEventArgs
160
                    {
161
                        CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(),
162
                        PageNumber = iPageNo,
163
                        PageUri = null
164
                    });
165 787a4489 KangIngu
                }
166
            }
167 3908a575 humkyung
168 83a98e96 송근호
            var border = VisualTreeHelper.GetChild(ImgListbox, 0);
169
            if(border!= null)
170
            {
171
                IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>();
172
            }
173 787a4489 KangIngu
        }
174
175
        public bool GotoPageFlag = false;
176
177 b2a6b24a humkyung
        /// <summary>
178
        /// 해당 썸네일로 이동
179
        /// </summary>
180 3908a575 humkyung
        /// <param name="_pageNumber">이동할 페이지 번호</param>
181 787a4489 KangIngu
        public void GotoPage(int _pageNumber)
182
        {
183 90e7968d ljiyeon
            try
184 787a4489 KangIngu
            {
185 3908a575 humkyung
                var _page = _thumbnailItems.Where(item => item.PageNumber == _pageNumber);
186
                if (_page.Count() > 0)
187 787a4489 KangIngu
                {
188 3908a575 humkyung
                    ThumbnailItem thumbnailitem = _page.First();
189
                    if (PageChanging != null)
190 90e7968d ljiyeon
                    {
191 3908a575 humkyung
                        var _itemIndex = this._thumbnailItems.IndexOf(thumbnailitem);
192
                        ImgListbox.SelectedItem = thumbnailitem;
193
194
                        if (_itemIndex < _thumbnailItems.Count() - 1)
195
                            ImgListbox.ScrollIntoView(_itemIndex);
196
                        else
197
                            ImgListbox.ScrollIntoView(this._thumbnailItems.Count() - 1);
198 90e7968d ljiyeon
                    }
199 787a4489 KangIngu
                }
200
            }
201 90e7968d ljiyeon
            catch(Exception ex)
202
            {
203
                Logger.sendResLog("GotoPage", ex.Message, 0);
204
            }
205
        }
206 787a4489 KangIngu
207 3908a575 humkyung
        /// <summary>
208
        /// 주어진 페이지로 변경한다
209
        /// </summary>
210
        /// <param name="iPageNo">변경할 페이지 번호</param>
211
        public void ChangePage(int iPageNo)
212 787a4489 KangIngu
        {
213 3908a575 humkyung
            var thumbitem = this._thumbnailItems.Where(item => item.PageNumber == iPageNo).FirstOrDefault();
214
            if ((PageChanged != null) && (thumbitem != null))
215 787a4489 KangIngu
            {
216 3908a575 humkyung
                var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString());
217
218
                var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber);
219
                if (_DocPages.Count() > 0)
220
                {
221
                    var _page = _DocPages.First();
222
223
                    PageChanged(this, new PageChangeEventArgs
224 787a4489 KangIngu
                    {
225 3908a575 humkyung
                        CurrentPage = _page,
226
                        PageUri = uri,
227
                        PageNumber = thumbitem.PageNumber
228 787a4489 KangIngu
                    });
229 3908a575 humkyung
                    ImgListbox.SelectedItem = thumbitem;
230 944be2fa djkim
                    this.CurrentPage = thumbitem;
231 3908a575 humkyung
                }
232
                else
233
                {
234
                    //System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다");
235 787a4489 KangIngu
                }
236
            }
237
        }
238 64f6713a humkyung
239 d974f3f8 ljiyeon
        public void GotoPageTALK(int _pageNumber, int _angle)
240
        {
241
            int _PageNo = -1;
242
243
            if (int.TryParse(_pageNumber.ToString(), out _PageNo))
244
            {
245
                var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo);
246
                if (_page.Count() > 0)
247
                {
248
                    ThumbnailItem _item = _page.First();
249
                    setPageChangeTALK(_item, _angle);
250
                    this.ImgListbox.SelectedIndex = _pageNumber - 1;
251
                    this.ImgListbox.ScrollIntoView(_pageNumber - 1);
252
                }
253
            }
254
        }
255
256
        public void setPageChangeTALK(ThumbnailItem thumbnailItem, int _angle)
257
        {
258
            if (thumbnailItem != null)
259
            {
260
                if (PageChanging != null)
261 90e7968d ljiyeon
                {
262 3908a575 humkyung
                    ///this.CurrentPage = _NextPage;
263
                    ///_NextPage = thumbnailItem;
264 d974f3f8 ljiyeon
                    PageChanging(this, new PageChangeEventArgs
265
                    {
266
                        CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(),
267
                        PageNumber = Convert.ToInt32(thumbnailItem.PageNumber),
268
                        PageUri = null
269
                    });
270
271
                    var instanceMain = this.ParentOfType<MainWindow>();
272
273
                    var rotationNum = (_angle - instanceMain.dzMainMenu.rotate.Angle) / 90;
274
275
                    if (rotationNum > 0) // 1, 2, 3
276
                    {
277 90e7968d ljiyeon
                        for (int i = 0; i < rotationNum; i++)
278 d974f3f8 ljiyeon
                        {
279
                            drawingPannelRotate(true);
280
                        }
281
                    }
282 90e7968d ljiyeon
                    else if (rotationNum < 0)// -1, -2, -3
283 d974f3f8 ljiyeon
                    {
284
                        for (int i = 0; i < -rotationNum; i++)
285
                        {
286
                            drawingPannelRotate(false);
287
                        }
288 90e7968d ljiyeon
                    }
289 d974f3f8 ljiyeon
                }
290
            }
291
        }
292 90e7968d ljiyeon
293 d974f3f8 ljiyeon
        public void drawingPannelRotate(bool Flag)
294
        {
295
            var instanceMain = this.ParentOfType<MainWindow>();
296
297
            if (Flag)
298
            {
299
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
300
                {
301
                    instanceMain.dzMainMenu.rotate.Angle = 0;
302
                }
303
                else
304
                {
305
                    instanceMain.dzMainMenu.rotate.Angle += 90;
306
                }
307
            }
308
            else
309
            {
310
                if (instanceMain.dzMainMenu.rotate.Angle == 0)
311
                {
312
                    instanceMain.dzMainMenu.rotate.Angle = 270;
313
                }
314
                else
315
                {
316
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
317
                }
318
            }
319
320
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
321
            {
322
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
323
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
324
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
325
            }
326 90e7968d ljiyeon
327 d974f3f8 ljiyeon
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
328
            {
329
                instanceMain.dzMainMenu.translate.X = 0;
330
                instanceMain.dzMainMenu.translate.Y = 0;
331
            }
332
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
333
            {
334
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
335
                instanceMain.dzMainMenu.translate.Y = 0;
336
            }
337
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
338
            {
339
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
340
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
341
            }
342
            else
343
            {
344
                instanceMain.dzMainMenu.translate.X = 0;
345
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
346
            }
347
348
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
349
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
350
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
351
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
352
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
353
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
354
355
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
356
            {
357
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
358
359
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
360
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
361
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
362
363
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
364
                if (rotationdoc != null)
365
                {
366
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
367
                }
368
                else
369
                {
370
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
371
                }
372 3908a575 humkyung
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
373 d974f3f8 ljiyeon
            });
374
        }
375
376 787a4489 KangIngu
        void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
377
        {
378
            SetCommentPages();
379
        }
380 39f0624f ljiyeon
        
381 787a4489 KangIngu
        void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
382
        {
383
            SetCommentPages();
384 6c781c0c djkim
            //System.Diagnostics.Debug.WriteLine(e.PropertyName);
385 787a4489 KangIngu
        }
386 39f0624f ljiyeon
387 787a4489 KangIngu
        public void SetCommentPages()
388
        {
389
            ThumbnailSet();
390
            SetCommentList(_UsersCommentPagesList.ToList());
391
        }
392
393
        public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList)
394
        {
395 548c696e ljiyeon
            Logger.sendCheckLog("SetCommentList", 1);
396 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_기존 Comment 색상 제거", 1);
397 787a4489 KangIngu
            #region 기존 색상 제거 작업
398
            foreach (var item in this._thumbnailItems)
399
            {
400
                item.DisplayColorItems.Clear();
401 122914ba ljiyeon
            }
402 787a4489 KangIngu
            #endregion
403
404 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_delItem select 및 remove", 1);
405 787a4489 KangIngu
            List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>();
406
407
            _UsersCommentPagesList.ToList().ForEach(item =>
408
            {
409
                var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID);
410
411
                if (_comm.Count() == 0)
412
                {
413
                    _delItem.Add(item);
414
                }
415
            });
416
417
            _delItem.ForEach(f => _UsersCommentPagesList.Remove(f));
418
419 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_UsersCommentPagesMember_PropertyChanged", 1);
420 787a4489 KangIngu
            UsersCommentPagesList.ForEach(user =>
421
            {
422
                user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
423
                user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
424
425
                var _commLst = _UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID);
426
427
                if (_commLst.Count() == 0)
428
                {
429
                    _UsersCommentPagesList.Add(user);
430
                }
431
                else
432
                {
433
                    if (_commLst.First().PageNumber != user.PageNumber)
434
                        _commLst.First().PageNumber = user.PageNumber;
435
                }
436
437
                user.PageNumber.ForEach(page =>
438
                {
439
                    var _items = this._thumbnailItems.Where(item => item.PageNumber == page);
440
441
                    if (_items.Count() > 0)
442
                        _items.First().DisplayColorItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor });
443
                });
444
            });
445
446
447 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_SelectComment.ItemsSource 설정", 1);
448 787a4489 KangIngu
            var data = _UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList();
449
            if (data.Count() != 0)
450
            {
451
                if (Convert.ToBoolean(data.First().isConSolidation))
452
                {
453
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated";
454
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = "";
455
                    this.lstSelectComment.ItemsSource = data;
456
                }
457
                else
458
                {
459
                    this.lstSelectComment.ItemsSource = _UsersCommentPagesList;  //섬네일   
460
                }
461
            }
462
            else
463
            {
464
                this.lstSelectComment.ItemsSource = _UsersCommentPagesList;  //섬네일   
465
            }
466
            //this.ImgListbox.ItemsSource = null;
467 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_ImgListbox 설정", 1);
468 90e7968d ljiyeon
469
       
470
                this.ImgListbox.ItemsSource = this._thumbnailItems;
471
                var template = this.ImgListbox.ItemTemplate;
472
                this.ImgListbox.ItemTemplate = null;
473
                this.ImgListbox.ItemTemplate = template;
474
               //Logger.sendCheckLog("SetCommentList_ImgListbox UpdateLayout_Start", 1);
475
                //this.ImgListbox.UpdateLayout();
476
                //Logger.sendCheckLog("SetCommentList_ImgListbox UpdateLayout_End", 1);
477
           
478 787a4489 KangIngu
        }
479
480
        private void ThumbnailSet()
481
        {
482 548c696e ljiyeon
            Logger.sendCheckLog("ThumbnailSet", 1);
483 787a4489 KangIngu
            if (!_Initialize) return;
484
485
            this._thumbnailItems = new ObservableCollection<ThumbnailItem>();
486
            List<int> _selectComment = new List<int>();
487
            if (this.lstSelectComment.ItemsSource != null)
488
            {
489
                var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>()
490
                             where commentPage.IsSelected == true
491
                             select commentPage.PageNumber;
492
493
                foreach (var item in _pages)
494
                {
495
                    item.ForEach(pp => _selectComment.Add(pp));
496
                }
497
498
                _selectComment.Distinct();
499
            }
500
501
            var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0");
502
            this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList();
503
            //this._PageList.ForEach(page =>
504
            ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page =>
505
            {
506
                var _pageNo = page.PAGE_NUMBER;
507
                bool _addFlag = false;
508
509 276fdd9b KangIngu
                if (rdoFavoritePages.IsChecked == false)
510 787a4489 KangIngu
                {
511 276fdd9b KangIngu
                    if (_selectComment.Count() > 0)
512 787a4489 KangIngu
                    {
513 276fdd9b KangIngu
                        if ((rdoAllPages.IsChecked == true)
514
                            || (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0))
515
                        {
516
                            _addFlag = true;
517
                        }
518 787a4489 KangIngu
                    }
519 276fdd9b KangIngu
                    else
520
                    {
521
                        //if (App.ViewInfo.IsCustomPage)
522
                        //{
523
                        //    //_addFlag = false;
524
525
                        //    //App.ViewInfo.IsCustomPage = false;
526
                        //    //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed;
527
                        //    //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed;
528
                        //    this.rdoAllPages.IsChecked = false;
529
                        //    this.rdoFavoritePages.IsChecked = true;
530
                        //    //SetCommentPages();                        
531
                        //}
532
                        //else
533
                        //{
534 787a4489 KangIngu
                        _addFlag = true;
535 276fdd9b KangIngu
                        //}
536
                    }
537 787a4489 KangIngu
                }
538
539
540 90e7968d ljiyeon
                if (_addFlag)
541 787a4489 KangIngu
                {
542
                    this._thumbnailItems.Add(new ThumbnailItem
543
                    {
544
                        ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
545 cdfb57ff taeseongkim
                        PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")),
546 787a4489 KangIngu
                        PageNumber = _pageNo,
547
                        Angle = page.PAGE_ANGLE,
548
                    });
549
                }
550
                else
551
                {
552 992a98b4 KangIngu
                    if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null)
553
                    {
554
                        this._thumbnailItems.Add(new ThumbnailItem
555
                        {
556
                            ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
557
                            PageNumber = _pageNo,
558
                            Angle = page.PAGE_ANGLE,
559
                        });
560
                    }
561 787a4489 KangIngu
                }
562
563
564
565
                //this._thumbnailItems.Add(new ThumbnailItem
566
                //{
567
                //    ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
568
569
                //    //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"),
570
571
                //    //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"),
572
                //    //DisplayColorItems = pageColor,
573
                //    PageNumber = Convert.ToInt32(_pageNo),
574
                //    Angle = Convert.ToInt32(page.PAGE_ANGLE),
575
                //});
576
            });
577
578
            //txtTotPageNo.Text = this._PageList.Count().ToString();
579
580
            //txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString());
581
582
            if (ImgListbox.ItemsSource == null)
583
            {
584
                ImgListbox.ItemsSource = this._thumbnailItems;
585
586
                this._thumbnailItems.ToList().ForEach(data =>
587
                {
588
                    data.Width = ImgListbox.ActualWidth;
589 5984979a ljiyeon
                    data.Height = ImgListbox.ActualHeight;
590 787a4489 KangIngu
                });
591
592
                if (ImgListbox.Items.Count > 0)
593
                {
594
                    //int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1;
595
                    int StartPageIdx = 1;
596
                    //if (App.ViewInfo.IsCustomPage)
597
                    //{
598
                    //    ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault();
599
                    //}
600
                    //else
601
                    //{
602
603
                    if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1)
604
                    {
605
                        ImgListbox.SelectedItem = ImgListbox.Items[0];
606
                    }
607
                    else
608
                    {
609
                        ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx];
610
                    }
611
                    //}
612
                }
613
            }
614
            else
615
            {
616
                ImgListbox.UpdateLayout();
617
                ImgListbox.ItemsSource = this._thumbnailItems;
618
            }
619
        }
620
621
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
622
        {
623
            if (e.ClickCount >= 2)
624
            {
625 39f0624f ljiyeon
                var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem;
626 787a4489 KangIngu
                GotoPage(selectItem.PageNumber);
627 5529d2a2 humkyung
                var result = MarkupParser.GetBaseControl(selectItem.Data);
628 90e7968d ljiyeon
                Rect rect = new Rect(new Point(result.StartPoint.X - 100, result.StartPoint.Y - 100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100));
629 787a4489 KangIngu
                this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
630
                //bool isGO = false;
631
632
                //var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer;
633
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
634
                //imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle;
635
                //imageViewer.InteractiveUserRectangle += (sen, ea) =>
636
                //{
637
                //    System.Diagnostics.Debug.WriteLine(ea.Bounds);
638
                //    if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End)
639
                //    {
640
                //        this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds);                        
641
                //    }
642
643
                //};
644
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal;
645
646 39f0624f ljiyeon
                //GotoPage(MarkupList.SelectedItem as MarkupList)
647 787a4489 KangIngu
            }
648
        }
649
650
        private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e)
651
        {
652 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
653 4eb052e4 ljiyeon
            tbSearch.Text = string.Empty;
654
655 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
656 4eb052e4 ljiyeon
657 39f0624f ljiyeon
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
658 4eb052e4 ljiyeon
659 39f0624f ljiyeon
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); }
660 4eb052e4 ljiyeon
661 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
662 4eb052e4 ljiyeon
663 39f0624f ljiyeon
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
664 787a4489 KangIngu
        }
665
666
        public class MarkupInfoItemSmall
667
        {
668
            public string Id { get; set; }
669
            public string UserName { get; set; }
670
            public string UserID { get; set; }
671
            public int PageNumber { get; set; }
672
            public string Data { get; set; }
673
            public int Data_Type { get; set; }
674
        }
675
676
        private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; }
677
        public List<MarkupInfoItemSmall> MarkupInfoSmallList
678
        {
679
            get
680
            {
681
                if (_MarkupInfoSmallList == null)
682
                {
683
                    _MarkupInfoSmallList = new List<MarkupInfoItemSmall>();
684
                }
685
                return _MarkupInfoSmallList;
686
            }
687
            set
688
            {
689 90e7968d ljiyeon
690 787a4489 KangIngu
                _MarkupInfoSmallList = value;
691
                RaisePropertyChanged("MarkupInfoSmallList");
692
            }
693
        }
694
695 2aaf9645 humkyung
        /// <summary>
696
        /// goto page and select item selected by user
697
        /// </summary>
698
        /// <param name="sender"></param>
699
        /// <param name="e"></param>
700 787a4489 KangIngu
        private void RadButton_Click(object sender, RoutedEventArgs e)
701
        {
702
            var clickButtonItem = sender as RadButton;
703
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
704
            {
705
                try
706
                {
707
                    Rect rect = new Rect();
708
                    Point s_point = new Point();
709
                    Point e_point = new Point();
710
711
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
712
                    GotoPage(Convert.ToInt32(gaza.PageNumber));
713 2aaf9645 humkyung
714 787a4489 KangIngu
                    var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업
715
                    switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString()))
716
                    {
717
                        case MarkupToPDF.Controls.Common.ControlType.TextControl:
718
                            {
719
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
720
                                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));
721
                            }
722
                            break;
723
                        case MarkupToPDF.Controls.Common.ControlType.TextBorder:
724
                            {
725
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
726
                                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));
727
                            }
728
                            break;
729
                        case MarkupToPDF.Controls.Common.ControlType.TextCloud:
730
                            {
731
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
732
                                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));
733
                            }
734
                            break;
735
                        case MarkupToPDF.Controls.Common.ControlType.PolygonControl:
736
                            {
737
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
738
739
                                foreach (Point A in instance.PointSet)
740
                                {
741
                                    if (s_point == new Point())
742
                                    {
743
                                        s_point = A;
744
                                        e_point = A;
745
                                    }
746
                                    s_point.X = Math.Min(s_point.X, A.X);
747
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
748
                                    e_point.X = Math.Max(e_point.X, A.X);
749
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
750
                                }
751
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
752
                            }
753
                            break;
754
                        case MarkupToPDF.Controls.Common.ControlType.PolygonCloud:
755
                            {
756
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
757
758
                                foreach (Point A in instance.PointSet)
759
                                {
760
                                    if (s_point == new Point())
761
                                    {
762
                                        s_point = A;
763
                                        e_point = A;
764
                                    }
765
                                    s_point.X = Math.Min(s_point.X, A.X);
766
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
767
                                    e_point.X = Math.Max(e_point.X, A.X);
768
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
769
                                }
770
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
771
                            }
772
                            break;
773
                        case MarkupToPDF.Controls.Common.ControlType.ChainLine:
774
                            {
775
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
776
777
                                foreach (Point A in instance.PointSet)
778
                                {
779
                                    if (s_point == new Point())
780
                                    {
781
                                        s_point = A;
782
                                        e_point = A;
783
                                    }
784
                                    s_point.X = Math.Min(s_point.X, A.X);
785
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
786
                                    e_point.X = Math.Max(e_point.X, A.X);
787
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
788
                                }
789
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
790
                            }
791
                            break;
792
                        case MarkupToPDF.Controls.Common.ControlType.Ink:
793
                            {
794
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
795
796
                                foreach (Point A in instance.PointSet)
797
                                {
798
                                    if (s_point == new Point())
799
                                    {
800
                                        s_point = A;
801
                                        e_point = A;
802
                                    }
803
                                    s_point.X = Math.Min(s_point.X, A.X);
804
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
805
                                    e_point.X = Math.Max(e_point.X, A.X);
806
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
807
                                }
808
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
809
                            }
810
                            break;
811
                        default:
812
                            MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
813
                            rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100));
814
                            break;
815
                    }
816
817 077896be humkyung
                    SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>());
818 787a4489 KangIngu
                    this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
819
                }
820
                catch (Exception ex)
821
                {
822 2aaf9645 humkyung
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
823 787a4489 KangIngu
                }
824
            }
825
        }
826
827 39f0624f ljiyeon
        private void MarkupList_Loaded(object sender, RoutedEventArgs e)
828 787a4489 KangIngu
        {
829
            if (MarkupInfoSmallList.Count == 0)
830
            {
831
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
832
                {
833
                    if (d.MarkupList != null)
834
                    {
835
                        d.MarkupList.ForEach(b =>
836
                        {
837
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
838
                            {
839
                                Id = b.ID,
840
                                Data = b.Data,
841
                                Data_Type = b.Data_Type,
842
                                PageNumber = b.PageNumber,
843
                                UserID = d.UserID,
844
                                UserName = d.UserName,
845
                            });
846
                        });
847
                    }
848
                });
849 39f0624f ljiyeon
                MarkupList.ItemsSource = null;
850
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
851 787a4489 KangIngu
852 90e7968d ljiyeon
                commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
853 787a4489 KangIngu
                commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
854
            }
855
        }
856
857 39f0624f ljiyeon
        public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item)
858 4eb052e4 ljiyeon
        {
859
            if (MarkupInfoSmallList.Count == 0)
860
            {
861
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
862
                {
863
                    if (d.MarkupList != null)
864
                    {
865
                        d.MarkupList.ForEach(b =>
866
                        {
867
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
868
                            {
869
                                Id = b.ID,
870
                                Data = b.Data,
871
                                Data_Type = b.Data_Type,
872
                                PageNumber = b.PageNumber,
873
                                UserID = d.UserID,
874
                                UserName = d.UserName,
875
                            });
876
                        });
877
                    }
878
                });
879 39f0624f ljiyeon
                MarkupList.ItemsSource = null;
880
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
881 4eb052e4 ljiyeon
                commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
882
                commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
883
            }
884
885
            switch (eventType)
886
            {
887
                case Event_Type.Create:
888
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
889
                    {
890
                        Id = res.CommentID,
891
                        Data = res.ConvertData,
892
                        Data_Type = res.DATA_TYPE,
893
                        PageNumber = CurrentPage.PageNumber,
894
                        UserID = App.ViewInfo.UserID,
895
                        UserName = App.UserName,
896
                    });
897
                    break;
898
                case Event_Type.Delete:
899
                    if(CommentID == null) //user information list delete btn
900
                    {
901
                        foreach (var delItem in item.MarkupList)
902
                        {
903
                            MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID);
904
                        }
905
                    }
906
                    else //delete, cut, 
907
                    {
908
                        MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID));
909
                    }                    
910
                    break;
911 39f0624f ljiyeon
                case Event_Type.Thumb://이동 회전
912 4eb052e4 ljiyeon
                    MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID));
913
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
914
                    {
915
                        Id = res.CommentID,
916
                        Data = res.ConvertData,
917
                        Data_Type = res.DATA_TYPE,
918
                        PageNumber = CurrentPage.PageNumber,
919
                        UserID = App.ViewInfo.UserID,
920
                        UserName = App.UserName,
921
                    });
922
                    break;
923
                default:
924
                    break;
925
            }
926
927 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
928
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
929 4eb052e4 ljiyeon
930 39f0624f ljiyeon
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList();                 }            
931 4eb052e4 ljiyeon
932 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
933
934
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();            
935 4eb052e4 ljiyeon
           
936
            commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
937 39f0624f ljiyeon
            commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();            
938 4eb052e4 ljiyeon
        }
939
940 787a4489 KangIngu
        private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e)
941
        {
942 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
943 79f3f21a djkim
            tbSearch.Text = string.Empty;
944 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
945
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
946 4eb052e4 ljiyeon
947 39f0624f ljiyeon
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); }
948 4eb052e4 ljiyeon
949 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
950 4eb052e4 ljiyeon
951 39f0624f ljiyeon
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
952 787a4489 KangIngu
        }
953
954
        private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e)
955
        {
956 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
957 79f3f21a djkim
            tbSearch.Text = string.Empty;
958 4eb052e4 ljiyeon
959 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
960
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
961 4eb052e4 ljiyeon
962 39f0624f ljiyeon
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); }
963 4eb052e4 ljiyeon
964 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
965 4eb052e4 ljiyeon
966 39f0624f ljiyeon
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
967 787a4489 KangIngu
        }
968
969
        private void btnPanorama_Click(object sender, RoutedEventArgs e)
970
        {
971
            ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow();
972
        }
973 79f3f21a djkim
974
        private void btnSearch_Click(object sender, RoutedEventArgs e)
975
        {
976
            string search_str = tbSearch.Text;
977
            var sel_type = commentType.SelectedItem;
978
            var sel_user = commentUser.SelectedItem;
979
            var sel_page = commentPage.SelectedItem;
980
            List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>();
981
            List<MarkupInfoItemSmall> list = MarkupInfoSmallList;
982 90e7968d ljiyeon
            if (sel_page != null)
983 79f3f21a djkim
            {
984
                list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList();
985
            }
986 90e7968d ljiyeon
            if (sel_type != null)
987 79f3f21a djkim
            {
988
                list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList();
989
            }
990
            if (sel_user != null)
991
            {
992
                list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList();
993
            }
994
            foreach (var item in list)
995
            {
996
                var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(item.Data.ToString());
997 90e7968d ljiyeon
998 79f3f21a djkim
                switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString()))
999 90e7968d ljiyeon
                {
1000 79f3f21a djkim
                    case MarkupToPDF.Controls.Common.ControlType.TextControl:
1001
                    case MarkupToPDF.Controls.Common.ControlType.TextBorder:
1002
                    case MarkupToPDF.Controls.Common.ControlType.TextCloud:
1003
                        {
1004
                            MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
1005
                            if (instance.Text.Contains(search_str))
1006 90e7968d ljiyeon
                            {
1007 79f3f21a djkim
                                small_list.Add(item);
1008
                            }
1009
                        }
1010
                        break;
1011
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl:
1012
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl:
1013
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl:
1014
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl:
1015
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl:
1016
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl:
1017
                        {
1018
                            MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data);
1019
                            if (instance.ArrowText.Contains(search_str))
1020
                            {
1021
                                small_list.Add(item);
1022
                            }
1023
                        }
1024
                        break;
1025
                }
1026
            }
1027 90e7968d ljiyeon
1028 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
1029
            MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList();
1030 79f3f21a djkim
            tbSearch.Text = string.Empty;
1031
        }
1032 787a4489 KangIngu
    }
1033
}
클립보드 이미지 추가 (최대 크기: 500 MB)