프로젝트

일반

사용자정보

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

markus / KCOM / Controls / Sample.xaml.cs @ 0beae8fb

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