프로젝트

일반

사용자정보

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

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

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