프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (55.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 2089959a taeseongkim
        {   
30
            if(App.IsDesignMode)
31
            {
32
                return;
33
            }
34
35 e0cfc73c ljiyeon
            App.splashString(ISplashMessage.SAMPLE);
36 0c997b99 ljiyeon
            this.Loaded += Sample_Loaded;
37
        }
38
39
        private void Sample_Loaded(object sender, RoutedEventArgs e)
40
        {
41 afaa7c92 djkim
            if(!_Initialize)
42
            {
43
                InitializeComponent();
44
                _Initialize = true;
45
                this.lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged);
46
                this.ImgListbox.SelectionChanged += new SelectionChangedEventHandler(ImgListbox_SelectionChanged);                
47
            }            
48 787a4489 KangIngu
        }
49
50
        public ObservableCollection<ThumbnailItem> _thumbnailItems;
51
        private List<DOCPAGE> _PageList = null;
52
        private string _DefaultUri = null;
53
        public ThumbnailItem CurrentPage = null;
54
        public int PageCount = 0;
55
        private bool _Initialize;
56
        public event EventHandler<PageChangeEventArgs> PageChanged;
57
        public event EventHandler<PageChangeEventArgs> PageChanging;
58
        List<UsersCommentPagesMember> _UsersCommentPagesList = new List<UsersCommentPagesMember>();
59
        public class PageChangeEventArgs : EventArgs
60
        {
61
            public DOCPAGE CurrentPage { get; set; }
62
            public string PageUri { get; set; }
63
            public int PageNumber { get; set; }
64
        }
65
        private bool _IsFitOn { get; set; }
66
        public bool IsFitOn
67
        {
68
            get
69
            {
70
                return _IsFitOn;
71
            }
72
            set
73
            {
74
                _IsFitOn = value;
75
                RaisePropertyChanged("IsFitOn");
76
            }
77
        }
78
79
        public void RaisePropertyChanged(string propName)
80
        {
81
            if (PropertyChanged != null)
82
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
83
        }
84
85
        public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri)
86
        {
87
            this._PageList = PageList;
88
            this._DefaultUri = DefaultUri;
89
            ThumbnailSet();
90
            this.PageCount = PageList.Count();
91
            //ThumbNmailSet();
92
            rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked);
93
            rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked);
94
            expCommentPages.PreviewCollapsed += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewCollapsed);
95
            expCommentPages.PreviewExpanded += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewExpanded);
96
        }
97 39f0624f ljiyeon
98 787a4489 KangIngu
        void rdoCommented_Checked(object sender, RoutedEventArgs e)
99
        {
100 548c696e ljiyeon
            Logger.sendCheckLog("rdoCommented_Checked", 1);
101 787a4489 KangIngu
            if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false;
102
            SetCommentPages();
103
        }
104
105
        void rdoFavoritePages_Checked(object sender, RoutedEventArgs e)
106
        {
107 548c696e ljiyeon
            Logger.sendCheckLog("rdoFavoritePages_Checked", 1);
108 992a98b4 KangIngu
            if (rdoFavoritePages.IsChecked == true)
109
                expCommentPages.IsExpanded = false;
110
111 90e7968d ljiyeon
            _FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet;
112 992a98b4 KangIngu
            if (_FavoriteSet.Count > 0)
113
            {
114
                SetCommentPages_Favorite(); //수정    
115
            }
116
            else
117
            {
118
                rdoAllPages.IsChecked = true;
119
                rdoFavoritePages.IsChecked = false;
120
            }
121
        }
122
123
        private void SetCommentPages_Favorite()
124
        {
125 90e7968d ljiyeon
            ThumbnailSet();            
126 992a98b4 KangIngu
            SetCommentPages();
127 787a4489 KangIngu
        }
128 992a98b4 KangIngu
129 787a4489 KangIngu
        void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e)
130
        {
131
            //txtThumbCount.Visibility = Visibility.Collapsed;            
132
        }
133
134
        void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e)
135
        {
136 548c696e ljiyeon
            Logger.sendCheckLog("expCommentPages_PreviewExpanded", 1);
137 787a4489 KangIngu
            rdoAllPages.IsChecked = false;
138
            rdoFavoritePages.IsChecked = false;
139
            //txtThumbCount.Visibility = Visibility.Visible;
140
            SetCommentPages();
141
        }
142
143 129ca191 humkyung
        /// <summary>
144
        /// called when image list box's selection is changed
145
        /// </summary>
146
        /// <param name="sender"></param>
147
        /// <param name="e"></param>
148 787a4489 KangIngu
        private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
149 afaa7c92 djkim
        {            
150 787a4489 KangIngu
            if (ImgListbox.SelectedItem != null)
151
            {
152 3908a575 humkyung
                int _CurrentPageNo = -1;
153 129ca191 humkyung
                if (this.CurrentPage != null)
154
                {
155
                    this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null);   /// save controls
156
                    _CurrentPageNo = this.CurrentPage.PageNumber;
157
                }
158 787a4489 KangIngu
159 129ca191 humkyung
                this.CurrentPage = ImgListbox.SelectedItem as ThumbnailItem;
160
                int iPageNo = this.CurrentPage.PageNumber;
161 3908a575 humkyung
                if(_CurrentPageNo != iPageNo)
162 787a4489 KangIngu
                {
163 3908a575 humkyung
                    PageChanging(this, new PageChangeEventArgs
164
                    {
165
                        CurrentPage = this._PageList.Where(p => p.PAGE_NUMBER == iPageNo).First(),
166
                        PageNumber = iPageNo,
167
                        PageUri = null
168
                    });
169 787a4489 KangIngu
                }
170
            }
171 3908a575 humkyung
172 2d584f1a djkim
            //var border = VisualTreeHelper.GetChild(ImgListbox, 0);
173
            //if (border != null)
174
            //{
175
            //    IEnumerable<ScrollViewer> scrollViewer = border.ChildrenOfType<ScrollViewer>();
176
177
            //}
178
            //ScrollViewer scrollViewer = (sender as RadListBox) as ScrollViewer;
179
180
            
181
            //System.Diagnostics.Debug.WriteLine("page:"+ImgListbox.SelectedIndex);
182 787a4489 KangIngu
        }
183
184
        public bool GotoPageFlag = false;
185
186 b2a6b24a humkyung
        /// <summary>
187
        /// 해당 썸네일로 이동
188
        /// </summary>
189 3908a575 humkyung
        /// <param name="_pageNumber">이동할 페이지 번호</param>
190 787a4489 KangIngu
        public void GotoPage(int _pageNumber)
191
        {
192 90e7968d ljiyeon
            try
193 787a4489 KangIngu
            {
194 a1142a6b taeseongkim
                System.Threading.Tasks.Task.Factory.StartNew(() => { 
195
196
                    var _page = _thumbnailItems.Where(item => item.PageNumber == _pageNumber);
197
                    if (_page.Count() > 0)
198 90e7968d ljiyeon
                    {
199 a1142a6b taeseongkim
                        ThumbnailItem thumbnailitem = _page.First();
200
                        if (PageChanging != null)
201
                        {
202
203
                            ImgListbox.Dispatcher.InvokeAsync(() => {  
204
                                var _itemIndex = this._thumbnailItems.IndexOf(thumbnailitem);
205
                                ImgListbox.SelectedItem = thumbnailitem;
206
                            });
207
                            //ImgListbox.Items.MoveCurrentTo(thumbnailitem);
208
                            //if (_itemIndex < _thumbnailItems.Count() - 1)
209
                            //    ImgListbox.ScrollIntoView(_itemIndex);
210
                            //else
211
                            //    ImgListbox.ScrollIntoView(this._thumbnailItems.Count() - 1);
212
                        }
213 90e7968d ljiyeon
                    }
214 a1142a6b taeseongkim
215
                }).ConfigureAwait(true);
216 787a4489 KangIngu
            }
217 90e7968d ljiyeon
            catch(Exception ex)
218
            {
219
                Logger.sendResLog("GotoPage", ex.Message, 0);
220
            }
221
        }
222 787a4489 KangIngu
223 3908a575 humkyung
        /// <summary>
224
        /// 주어진 페이지로 변경한다
225
        /// </summary>
226
        /// <param name="iPageNo">변경할 페이지 번호</param>
227
        public void ChangePage(int iPageNo)
228 787a4489 KangIngu
        {
229 3908a575 humkyung
            var thumbitem = this._thumbnailItems.Where(item => item.PageNumber == iPageNo).FirstOrDefault();
230
            if ((PageChanged != null) && (thumbitem != null))
231 787a4489 KangIngu
            {
232 d48260a2 djkim
                var uri = thumbitem.PageUri.ToString();
233
                    //_DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString());
234 3908a575 humkyung
235 d48260a2 djkim
                var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber).FirstOrDefault();
236
                if (_DocPages != null)
237 3908a575 humkyung
                {
238
                    PageChanged(this, new PageChangeEventArgs
239 787a4489 KangIngu
                    {
240 d48260a2 djkim
                        CurrentPage = _DocPages,
241 3908a575 humkyung
                        PageUri = uri,
242
                        PageNumber = thumbitem.PageNumber
243 787a4489 KangIngu
                    });
244 2d584f1a djkim
                    //ImgListbox.SelectedItem = thumbitem;                    
245
                    //ImgListbox.Items.MoveCurrentTo(thumbitem);
246
                    
247 944be2fa djkim
                    this.CurrentPage = thumbitem;
248 3908a575 humkyung
                }
249
                else
250
                {
251
                    //System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다");
252 787a4489 KangIngu
                }
253
            }
254
        }
255 64f6713a humkyung
256 d974f3f8 ljiyeon
        public void GotoPageTALK(int _pageNumber, int _angle)
257
        {
258
            int _PageNo = -1;
259
260
            if (int.TryParse(_pageNumber.ToString(), out _PageNo))
261
            {
262
                var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo);
263
                if (_page.Count() > 0)
264
                {
265
                    ThumbnailItem _item = _page.First();
266
                    setPageChangeTALK(_item, _angle);
267
                    this.ImgListbox.SelectedIndex = _pageNumber - 1;
268 6443ebfe djkim
                    //this.ImgListbox.ScrollIntoView(_pageNumber - 1);
269 d974f3f8 ljiyeon
                }
270
            }
271
        }
272
273
        public void setPageChangeTALK(ThumbnailItem thumbnailItem, int _angle)
274
        {
275
            if (thumbnailItem != null)
276
            {
277
                if (PageChanging != null)
278 90e7968d ljiyeon
                {
279 3908a575 humkyung
                    ///this.CurrentPage = _NextPage;
280
                    ///_NextPage = thumbnailItem;
281 d974f3f8 ljiyeon
                    PageChanging(this, new PageChangeEventArgs
282
                    {
283
                        CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(),
284
                        PageNumber = Convert.ToInt32(thumbnailItem.PageNumber),
285
                        PageUri = null
286
                    });
287
288
                    var instanceMain = this.ParentOfType<MainWindow>();
289
290
                    var rotationNum = (_angle - instanceMain.dzMainMenu.rotate.Angle) / 90;
291
292
                    if (rotationNum > 0) // 1, 2, 3
293
                    {
294 90e7968d ljiyeon
                        for (int i = 0; i < rotationNum; i++)
295 d974f3f8 ljiyeon
                        {
296
                            drawingPannelRotate(true);
297
                        }
298
                    }
299 90e7968d ljiyeon
                    else if (rotationNum < 0)// -1, -2, -3
300 d974f3f8 ljiyeon
                    {
301
                        for (int i = 0; i < -rotationNum; i++)
302
                        {
303
                            drawingPannelRotate(false);
304
                        }
305 90e7968d ljiyeon
                    }
306 d974f3f8 ljiyeon
                }
307
            }
308
        }
309 90e7968d ljiyeon
310 d974f3f8 ljiyeon
        public void drawingPannelRotate(bool Flag)
311
        {
312
            var instanceMain = this.ParentOfType<MainWindow>();
313
314
            if (Flag)
315
            {
316
                if (instanceMain.dzMainMenu.rotate.Angle == 270)
317
                {
318
                    instanceMain.dzMainMenu.rotate.Angle = 0;
319
                }
320
                else
321
                {
322
                    instanceMain.dzMainMenu.rotate.Angle += 90;
323
                }
324
            }
325
            else
326
            {
327
                if (instanceMain.dzMainMenu.rotate.Angle == 0)
328
                {
329
                    instanceMain.dzMainMenu.rotate.Angle = 270;
330
                }
331
                else
332
                {
333
                    instanceMain.dzMainMenu.rotate.Angle -= 90;
334
                }
335
            }
336
337
            if (instanceMain.dzMainMenu.zoomAndPanCanvas.Width == ViewerDataModel.Instance.ContentWidth)
338
            {
339
                double emptySize = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
340
                instanceMain.dzMainMenu.zoomAndPanCanvas.Width = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
341
                instanceMain.dzMainMenu.zoomAndPanCanvas.Height = emptySize;
342
            }
343 90e7968d ljiyeon
344 d974f3f8 ljiyeon
            if (instanceMain.dzMainMenu.rotate.Angle == 0)
345
            {
346
                instanceMain.dzMainMenu.translate.X = 0;
347
                instanceMain.dzMainMenu.translate.Y = 0;
348
            }
349
            else if (instanceMain.dzMainMenu.rotate.Angle == 90)
350
            {
351
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
352
                instanceMain.dzMainMenu.translate.Y = 0;
353
            }
354
            else if (instanceMain.dzMainMenu.rotate.Angle == 180)
355
            {
356
                instanceMain.dzMainMenu.translate.X = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
357
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
358
            }
359
            else
360
            {
361
                instanceMain.dzMainMenu.translate.X = 0;
362
                instanceMain.dzMainMenu.translate.Y = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
363
            }
364
365
            instanceMain.dzMainMenu.zoomAndPanControl.RotationAngle = instanceMain.dzMainMenu.rotate.Angle;
366
            ViewerDataModel.Instance.ContentWidth = instanceMain.dzMainMenu.zoomAndPanCanvas.Width;
367
            ViewerDataModel.Instance.ContentHeight = instanceMain.dzMainMenu.zoomAndPanCanvas.Height;
368
            ViewerDataModel.Instance.AngleOffsetX = instanceMain.dzMainMenu.translate.X;
369
            ViewerDataModel.Instance.AngleOffsetY = instanceMain.dzMainMenu.translate.Y;
370
            ViewerDataModel.Instance.Angle = instanceMain.dzMainMenu.rotate.Angle;
371
372
            instanceMain.dzMainMenu.pageNavigator._thumbnailItems.Where(info => info.PageNumber == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).ToList().ForEach(data =>
373
            {
374
                data.Angle = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
375
376
                instanceMain.dzMainMenu.pageNavigator.ImgListbox.ItemsSource = instanceMain.dzMainMenu.pageNavigator._thumbnailItems;
377
                var instance = instanceMain.dzMainMenu.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == instanceMain.dzMainMenu.pageNavigator.CurrentPage.PageNumber).FirstOrDefault();
378
                instance.PAGE_ANGLE = int.Parse(instanceMain.dzMainMenu.rotate.Angle.ToString());
379
380
                var rotationdoc = ViewerDataModel.Instance.RotationDocs.Where(d => d.ID == instance.ID).FirstOrDefault();
381
                if (rotationdoc != null)
382
                {
383
                    rotationdoc.PAGE_ANGLE = instance.PAGE_ANGLE;
384
                }
385
                else
386
                {
387
                    ViewerDataModel.Instance.RotationDocs.Add(instance);
388
                }
389 3908a575 humkyung
                instanceMain.dzMainMenu.pageNavigator.GotoPage(data.PageNumber);
390 d974f3f8 ljiyeon
            });
391
        }
392
393 787a4489 KangIngu
        void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
394
        {
395
            SetCommentPages();
396
        }
397 39f0624f ljiyeon
        
398 787a4489 KangIngu
        void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
399
        {
400
            SetCommentPages();
401 6c781c0c djkim
            //System.Diagnostics.Debug.WriteLine(e.PropertyName);
402 787a4489 KangIngu
        }
403 39f0624f ljiyeon
404 787a4489 KangIngu
        public void SetCommentPages()
405
        {
406
            ThumbnailSet();
407
            SetCommentList(_UsersCommentPagesList.ToList());
408
        }
409
410
        public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList)
411
        {
412 548c696e ljiyeon
            Logger.sendCheckLog("SetCommentList", 1);
413 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_기존 Comment 색상 제거", 1);
414 787a4489 KangIngu
            #region 기존 색상 제거 작업
415
            foreach (var item in this._thumbnailItems)
416
            {
417
                item.DisplayColorItems.Clear();
418 122914ba ljiyeon
            }
419 787a4489 KangIngu
            #endregion
420
421 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_delItem select 및 remove", 1);
422 787a4489 KangIngu
            List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>();
423
424
            _UsersCommentPagesList.ToList().ForEach(item =>
425
            {
426
                var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID);
427
428
                if (_comm.Count() == 0)
429
                {
430
                    _delItem.Add(item);
431
                }
432
            });
433
434
            _delItem.ForEach(f => _UsersCommentPagesList.Remove(f));
435
436 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_UsersCommentPagesMember_PropertyChanged", 1);
437 81e3a60f 송근호
            List<SetColorMarkupItem> setColorMarkupItems = new List<SetColorMarkupItem>();
438
439 787a4489 KangIngu
            UsersCommentPagesList.ForEach(user =>
440
            {
441
                user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
442
                user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
443
444
                var _commLst = _UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID);
445
446
                if (_commLst.Count() == 0)
447
                {
448
                    _UsersCommentPagesList.Add(user);
449
                }
450
                else
451
                {
452
                    if (_commLst.First().PageNumber != user.PageNumber)
453
                        _commLst.First().PageNumber = user.PageNumber;
454
                }
455
456
                user.PageNumber.ForEach(page =>
457
                {
458
                    var _items = this._thumbnailItems.Where(item => item.PageNumber == page);
459
460
                    if (_items.Count() > 0)
461 81e3a60f 송근호
                    {
462
                        setColorMarkupItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor, markupID = user.MarkupInfoID, Page = page });
463
                        
464
                    }
465
                        
466 787a4489 KangIngu
                });
467
            });
468
469 81e3a60f 송근호
            foreach (var item in this._thumbnailItems)
470
            {
471 8ff1bf3a 송근호
                item.DisplayColorItems = setColorMarkupItems.Where(color => color.Page == item.PageNumber).ToList();
472 81e3a60f 송근호
            }
473
            
474 122914ba ljiyeon
            Logger.sendCheckLog("SetCommentList_SelectComment.ItemsSource 설정", 1);
475 787a4489 KangIngu
            var data = _UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList();
476
            if (data.Count() != 0)
477
            {
478
                if (Convert.ToBoolean(data.First().isConSolidation))
479
                {
480
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated";
481
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = "";
482
                    this.lstSelectComment.ItemsSource = data;
483
                }
484
                else
485
                {
486
                    this.lstSelectComment.ItemsSource = _UsersCommentPagesList;  //섬네일   
487
                }
488
            }
489
            else
490
            {
491
                this.lstSelectComment.ItemsSource = _UsersCommentPagesList;  //섬네일   
492
            }
493 81e3a60f 송근호
            
494
            Logger.sendCheckLog("SetComme6ntList_ImgListbox 설정", 1);
495 90e7968d ljiyeon
496 2d584f1a djkim
497 81e3a60f 송근호
            //var template = this.ImgListbox.ItemTemplate;
498
            //this.ImgListbox.ItemTemplate = null;
499
            //this.ImgListbox.ItemTemplate = template;
500 2d584f1a djkim
501 787a4489 KangIngu
        }
502
503
        private void ThumbnailSet()
504
        {
505 548c696e ljiyeon
            Logger.sendCheckLog("ThumbnailSet", 1);
506 787a4489 KangIngu
            if (!_Initialize) return;
507
508
            this._thumbnailItems = new ObservableCollection<ThumbnailItem>();
509
            List<int> _selectComment = new List<int>();
510
            if (this.lstSelectComment.ItemsSource != null)
511
            {
512
                var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>()
513
                             where commentPage.IsSelected == true
514
                             select commentPage.PageNumber;
515
516
                foreach (var item in _pages)
517
                {
518
                    item.ForEach(pp => _selectComment.Add(pp));
519
                }
520
521
                _selectComment.Distinct();
522
            }
523
524
            var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0");
525
            this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList();
526
            //this._PageList.ForEach(page =>
527
            ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page =>
528
            {
529
                var _pageNo = page.PAGE_NUMBER;
530
                bool _addFlag = false;
531
532 276fdd9b KangIngu
                if (rdoFavoritePages.IsChecked == false)
533 787a4489 KangIngu
                {
534 276fdd9b KangIngu
                    if (_selectComment.Count() > 0)
535 787a4489 KangIngu
                    {
536 276fdd9b KangIngu
                        if ((rdoAllPages.IsChecked == true)
537
                            || (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0))
538
                        {
539
                            _addFlag = true;
540
                        }
541 787a4489 KangIngu
                    }
542 276fdd9b KangIngu
                    else
543
                    {
544
                        //if (App.ViewInfo.IsCustomPage)
545
                        //{
546
                        //    //_addFlag = false;
547
548
                        //    //App.ViewInfo.IsCustomPage = false;
549
                        //    //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed;
550
                        //    //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed;
551
                        //    this.rdoAllPages.IsChecked = false;
552
                        //    this.rdoFavoritePages.IsChecked = true;
553
                        //    //SetCommentPages();                        
554
                        //}
555
                        //else
556
                        //{
557 787a4489 KangIngu
                        _addFlag = true;
558 276fdd9b KangIngu
                        //}
559
                    }
560 787a4489 KangIngu
                }
561
562
563 90e7968d ljiyeon
                if (_addFlag)
564 787a4489 KangIngu
                {
565
                    this._thumbnailItems.Add(new ThumbnailItem
566
                    {
567
                        ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
568 cdfb57ff taeseongkim
                        PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")),
569 787a4489 KangIngu
                        PageNumber = _pageNo,
570
                        Angle = page.PAGE_ANGLE,
571
                    });
572
                }
573
                else
574
                {
575 992a98b4 KangIngu
                    if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null)
576
                    {
577
                        this._thumbnailItems.Add(new ThumbnailItem
578
                        {
579
                            ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
580
                            PageNumber = _pageNo,
581
                            Angle = page.PAGE_ANGLE,
582
                        });
583
                    }
584 787a4489 KangIngu
                }
585
586
587
588
                //this._thumbnailItems.Add(new ThumbnailItem
589
                //{
590
                //    ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
591
592
                //    //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"),
593
594
                //    //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"),
595
                //    //DisplayColorItems = pageColor,
596
                //    PageNumber = Convert.ToInt32(_pageNo),
597
                //    Angle = Convert.ToInt32(page.PAGE_ANGLE),
598
                //});
599
            });
600
601
            //txtTotPageNo.Text = this._PageList.Count().ToString();
602
603
            //txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString());
604
605
            if (ImgListbox.ItemsSource == null)
606
            {
607
                ImgListbox.ItemsSource = this._thumbnailItems;
608
609
                this._thumbnailItems.ToList().ForEach(data =>
610
                {
611
                    data.Width = ImgListbox.ActualWidth;
612 5984979a ljiyeon
                    data.Height = ImgListbox.ActualHeight;
613 787a4489 KangIngu
                });
614
615
                if (ImgListbox.Items.Count > 0)
616
                {
617
                    //int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1;
618
                    int StartPageIdx = 1;
619
                    //if (App.ViewInfo.IsCustomPage)
620
                    //{
621
                    //    ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault();
622
                    //}
623
                    //else
624
                    //{
625
626
                    if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1)
627
                    {
628
                        ImgListbox.SelectedItem = ImgListbox.Items[0];
629
                    }
630
                    else
631
                    {
632
                        ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx];
633
                    }
634
                    //}
635
                }
636
            }
637
            else
638
            {
639
                ImgListbox.UpdateLayout();
640
                ImgListbox.ItemsSource = this._thumbnailItems;
641
            }
642
        }
643
644
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
645
        {
646
            if (e.ClickCount >= 2)
647
            {
648 39f0624f ljiyeon
                var selectItem = MarkupList.SelectedItem as IKCOM.MarkupItem;
649 787a4489 KangIngu
                GotoPage(selectItem.PageNumber);
650 5529d2a2 humkyung
                var result = MarkupParser.GetBaseControl(selectItem.Data);
651 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));
652 787a4489 KangIngu
                this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
653
                //bool isGO = false;
654
655
                //var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer;
656
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
657
                //imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle;
658
                //imageViewer.InteractiveUserRectangle += (sen, ea) =>
659
                //{
660
                //    System.Diagnostics.Debug.WriteLine(ea.Bounds);
661
                //    if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End)
662
                //    {
663
                //        this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds);                        
664
                //    }
665
666
                //};
667
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal;
668
669 39f0624f ljiyeon
                //GotoPage(MarkupList.SelectedItem as MarkupList)
670 787a4489 KangIngu
            }
671
        }
672
673
        private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e)
674
        {
675 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
676 2089959a taeseongkim
            txtSearch.Text = string.Empty;
677 4eb052e4 ljiyeon
678 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
679 4eb052e4 ljiyeon
680 39f0624f ljiyeon
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
681 4eb052e4 ljiyeon
682 8e5a4a6a taeseongkim
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((MarkupUserInfo)commentUser.SelectedValue).UserName).ToList(); }
683 4eb052e4 ljiyeon
684 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
685 4eb052e4 ljiyeon
686 39f0624f ljiyeon
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
687 787a4489 KangIngu
        }
688
689
        public class MarkupInfoItemSmall
690
        {
691
            public string Id { get; set; }
692
            public string UserName { get; set; }
693
            public string UserID { get; set; }
694
            public int PageNumber { get; set; }
695
            public string Data { get; set; }
696
            public int Data_Type { get; set; }
697
        }
698
699
        private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; }
700
        public List<MarkupInfoItemSmall> MarkupInfoSmallList
701
        {
702
            get
703
            {
704
                if (_MarkupInfoSmallList == null)
705
                {
706
                    _MarkupInfoSmallList = new List<MarkupInfoItemSmall>();
707
                }
708
                return _MarkupInfoSmallList;
709
            }
710
            set
711
            {
712 90e7968d ljiyeon
713 787a4489 KangIngu
                _MarkupInfoSmallList = value;
714
                RaisePropertyChanged("MarkupInfoSmallList");
715
            }
716
        }
717
718 2aaf9645 humkyung
        /// <summary>
719
        /// goto page and select item selected by user
720
        /// </summary>
721
        /// <param name="sender"></param>
722
        /// <param name="e"></param>
723 2089959a taeseongkim
        private void RadButton_Click_OLD(object sender, RoutedEventArgs e)
724 787a4489 KangIngu
        {
725
            var clickButtonItem = sender as RadButton;
726
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
727
            {
728
                try
729
                {
730
                    Rect rect = new Rect();
731
                    Point s_point = new Point();
732
                    Point e_point = new Point();
733
734
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
735
                    GotoPage(Convert.ToInt32(gaza.PageNumber));
736 2aaf9645 humkyung
737 787a4489 KangIngu
                    var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업
738
                    switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString()))
739
                    {
740
                        case MarkupToPDF.Controls.Common.ControlType.TextControl:
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.TextBorder:
747
                            {
748
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
749
                                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));
750
                            }
751
                            break;
752
                        case MarkupToPDF.Controls.Common.ControlType.TextCloud:
753
                            {
754
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
755
                                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));
756
                            }
757
                            break;
758
                        case MarkupToPDF.Controls.Common.ControlType.PolygonControl:
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.PolygonCloud:
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.ChainLine:
797
                            {
798
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
799
800
                                foreach (Point A in instance.PointSet)
801
                                {
802
                                    if (s_point == new Point())
803
                                    {
804
                                        s_point = A;
805
                                        e_point = A;
806
                                    }
807
                                    s_point.X = Math.Min(s_point.X, A.X);
808
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
809
                                    e_point.X = Math.Max(e_point.X, A.X);
810
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
811
                                }
812
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
813
                            }
814
                            break;
815
                        case MarkupToPDF.Controls.Common.ControlType.Ink:
816
                            {
817
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
818
819
                                foreach (Point A in instance.PointSet)
820
                                {
821
                                    if (s_point == new Point())
822
                                    {
823
                                        s_point = A;
824
                                        e_point = A;
825
                                    }
826
                                    s_point.X = Math.Min(s_point.X, A.X);
827
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
828
                                    e_point.X = Math.Max(e_point.X, A.X);
829
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
830
                                }
831
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
832
                            }
833
                            break;
834
                        default:
835
                            MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
836
                            rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100));
837
                            break;
838
                    }
839
840 077896be humkyung
                    SelectionSet.Instance.SelectItemByRect(rect, this.ParentOfType<KCOM.Views.MainMenu>());
841 787a4489 KangIngu
                    this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
842
                }
843
                catch (Exception ex)
844
                {
845 2aaf9645 humkyung
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
846 787a4489 KangIngu
                }
847
            }
848
        }
849
850 2089959a taeseongkim
851
        private void btGotoMarkup_Click(object sender, RoutedEventArgs e)
852
        {
853
            var clickButtonItem = sender as RadButton;
854
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
855
            {
856
                try
857
                {
858
             
859
860
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
861
                    MarkupList.SelectedItem = gaza;
862
863 c7fde400 taeseongkim
                    MarkupHelper.GotoMarkup(new[] { gaza.Id });
864 2089959a taeseongkim
                }
865
                catch (Exception ex)
866
                {
867
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
868
                }
869
            }
870
        }
871
872 c7fde400 taeseongkim
        ///// <summary>
873
        ///// 선택된 마크업의 ID리스트를 받아 해당 페이지로 이동 후 GotoSelectedMarkup 호출
874
        ///// </summary>
875
        ///// <param name="CommentIdList"></param>
876
        //private void GotoMarkup(IEnumerable<string> CommentIdList)
877
        //{
878
        //    var instance = Common.ViewerDataModel.Instance;
879
880
        //    SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
881
882
        //    var commentList = instance._markupInfoList.Where(x => x.MarkupList != null).SelectMany(x => x.MarkupList).Where(f => f.ID == CommentIdList.First());
883
884
        //    if (commentList.Count() > 0)
885
        //    {
886
        //        //하단 그리드의 markup list에서 commentid가 포함된 markupinfo를 선택되게 한다.
887
        //        #region markup list grid select items
888
889
        //        var infoItem = instance._markupInfoList.Where(x => x.MarkupList != null).Where(f => f.MarkupList.Count(y => y == commentList.First()) > 0);
890
891
        //        if (infoItem.Count() > 0)
892
        //        {
893
894
        //            var gridMarkup = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup;
895
        //            gridMarkup.SelectedItems.Clear();
896
        //            gridMarkup.SelectedItems.Add(infoItem.First());
897
        //        }
898
899
        //        #endregion
900
901
        //        var pageNavigator = instance.SystemMain.dzMainMenu.pageNavigator;
902
903
        //        if (pageNavigator.CurrentPage.PageNumber == commentList.First().PageNumber)
904
        //        {
905
        //            GotoSelectedMarkup(CommentIdList);
906
        //        }
907
        //        else
908
        //        {
909
        //            EventHandler<Sample.PageChangeEventArgs> handler = null;
910
911
        //            handler = (snd, evt) =>
912
        //            {
913
        //                GotoSelectedMarkup(CommentIdList);
914
        //                pageNavigator.PageChanged -= handler;
915
        //            };
916
917
        //            pageNavigator.PageChanged += handler;
918
919
        //            pageNavigator.GotoPage(commentList.First().PageNumber);
920
        //        }
921
        //    }
922
        //}
923
924
        ///// <summary>
925
        ///// 페이지 이동 후 마크업을 선택하고 Zoom을 한다.
926
        ///// 마크업이 페이지보다 크면 Zoom을 하지 않음.
927
        ///// </summary>
928
        ///// <param name="CommentIdList"></param>
929
        //private void GotoSelectedMarkup(IEnumerable<string> CommentIdList)
930
        //{
931
        //    var instance = Common.ViewerDataModel.Instance;
932
933
        //    var selectOrderComments = instance.MarkupControls.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
934
        //    var commentUserInfo = instance.MarkupControls_USER.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
935
936
        //    if (commentUserInfo.Count() > 0 || selectOrderComments.Count() > 0)
937
        //    {
938
        //        commentUserInfo.ForEach(x => x.IsSelected = true);
939
        //        commentUserInfo.AddRange(selectOrderComments);
940
941
        //        if (commentUserInfo?.Count() > 0)
942
        //        {
943
        //            var main = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
944
945
        //            try
946
        //            {
947
        //                if(Common.ViewerDataModel.Instance.Angle != 0)
948
        //                {
949
        //                    for (int i = 0; i < (Common.ViewerDataModel.Instance.Angle / 90); i++)
950
        //                    {
951
        //                        Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.drawingPannelRotate(true);
952
        //                    } 
953 5beaf28e taeseongkim
                            
954 c7fde400 taeseongkim
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle = 0;
955
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.X = 0;
956
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.Y = 0;
957
        //                }
958 5beaf28e taeseongkim
959 c7fde400 taeseongkim
        //                Rect rect = commentUserInfo.First().ItemRect;
960 2089959a taeseongkim
961 c7fde400 taeseongkim
        //                foreach (var UserInfo in commentUserInfo)
962
        //                {
963
        //                    rect = Rect.Union(rect, UserInfo.ItemRect);
964
        //                }
965 2089959a taeseongkim
966 c7fde400 taeseongkim
        //                SelectionSet.Instance.SelectItemByRect(rect, main);
967 2089959a taeseongkim
968 c7fde400 taeseongkim
        //                var center = new Vector(Common.ViewerDataModel.Instance.ImageViewWidth / 2, Common.ViewerDataModel.Instance.ImageViewHeight / 2);
969
        //                //var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
970
        //                //rect.Transform(matrix);
971 2089959a taeseongkim
972 c7fde400 taeseongkim
        //                double scaleX = Common.ViewerDataModel.Instance.ImageViewWidth / rect.Width;
973
        //                double scaleY = Common.ViewerDataModel.Instance.ImageViewHeight / rect.Height;
974
        //                double newScale = main.zoomAndPanControl.ContentScale * Math.Min(scaleX, scaleY);
975
        //                double positionX = 0;
976
        //                double positionY = 0;
977 2089959a taeseongkim
978 c7fde400 taeseongkim
        //                if (Common.ViewerDataModel.Instance.Angle == 90)
979
        //                {
980
        //                    positionX = Common.ViewerDataModel.Instance.ImageViewHeight + rect.X;
981
        //                    positionY = Common.ViewerDataModel.Instance.ImageViewWidth + rect.Y;
982
        //                }
983 2089959a taeseongkim
984 c7fde400 taeseongkim
        //                main.zoomAndPanControl.ContentScale = newScale;
985
        //                main.zoomAndPanControl.ContentOffsetX = positionX;
986
        //                main.zoomAndPanControl.ContentOffsetY = positionY;
987 2089959a taeseongkim
988
              
989 c7fde400 taeseongkim
        //                var pageSize = new Size(main.pageNavigator.CurrentPage.Width, main.pageNavigator.CurrentPage.Height);
990
991
        //                double pageAngle = Common.ViewerDataModel.Instance.Angle;
992
993
        //                if (pageAngle == 90)
994
        //                {
995
        //                    pageAngle = 270;
996
        //                }
997
        //                else
998
        //                {
999
        //                    pageAngle = 90;
1000
        //                }
1001
1002
        //                if ((rect.Size.Width + rect.Size.Height) > (pageSize.Width + pageSize.Height))
1003
        //                {
1004
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1005
        //                    rect.Transform(matrix);
1006
1007
        //                    main.zoomAndPanControl.ZoomTo(rect);
1008
        //                }
1009
        //                else
1010
        //                {
1011
        //                    rect.Inflate(rect.Width * 3, rect.Height * 3);
1012
1013
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1014
        //                    rect.Transform(matrix);
1015
1016
1017
        //                    main.zoomAndPanControl.ZoomTo(rect);
1018
        //                }
1019
        //            }
1020
        //            catch (Exception ex)
1021
        //            {
1022
        //                main.DialogMessage_Alert(ex.Message, "Error");
1023
        //            }
1024
        //        }
1025
        //    }
1026
        //}
1027 2089959a taeseongkim
1028 39f0624f ljiyeon
        private void MarkupList_Loaded(object sender, RoutedEventArgs e)
1029 787a4489 KangIngu
        {
1030
            if (MarkupInfoSmallList.Count == 0)
1031
            {
1032
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
1033
                {
1034
                    if (d.MarkupList != null)
1035
                    {
1036
                        d.MarkupList.ForEach(b =>
1037
                        {
1038
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1039
                            {
1040
                                Id = b.ID,
1041
                                Data = b.Data,
1042
                                Data_Type = b.Data_Type,
1043
                                PageNumber = b.PageNumber,
1044
                                UserID = d.UserID,
1045
                                UserName = d.UserName,
1046
                            });
1047
                        });
1048
                    }
1049
                });
1050 39f0624f ljiyeon
                MarkupList.ItemsSource = null;
1051
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1052 787a4489 KangIngu
1053 90e7968d ljiyeon
                commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
1054 787a4489 KangIngu
                commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1055
            }
1056
        }
1057
1058 39f0624f ljiyeon
        public void MarkupListUpdate(MarkupReturn res, Event_Type eventType, string CommentID, MarkupInfoItem item)
1059 4eb052e4 ljiyeon
        {
1060
            if (MarkupInfoSmallList.Count == 0)
1061
            {
1062
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
1063
                {
1064
                    if (d.MarkupList != null)
1065
                    {
1066
                        d.MarkupList.ForEach(b =>
1067
                        {
1068
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1069
                            {
1070
                                Id = b.ID,
1071
                                Data = b.Data,
1072
                                Data_Type = b.Data_Type,
1073
                                PageNumber = b.PageNumber,
1074
                                UserID = d.UserID,
1075
                                UserName = d.UserName,
1076
                            });
1077
                        });
1078
                    }
1079
                });
1080 39f0624f ljiyeon
                MarkupList.ItemsSource = null;
1081
                MarkupList.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1082 4eb052e4 ljiyeon
                commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();
1083
                commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1084
            }
1085
1086
            switch (eventType)
1087
            {
1088
                case Event_Type.Create:
1089
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1090
                    {
1091
                        Id = res.CommentID,
1092
                        Data = res.ConvertData,
1093
                        Data_Type = res.DATA_TYPE,
1094
                        PageNumber = CurrentPage.PageNumber,
1095
                        UserID = App.ViewInfo.UserID,
1096
                        UserName = App.UserName,
1097
                    });
1098
                    break;
1099
                case Event_Type.Delete:
1100
                    if(CommentID == null) //user information list delete btn
1101
                    {
1102
                        foreach (var delItem in item.MarkupList)
1103
                        {
1104
                            MarkupInfoSmallList.RemoveAll(p => p.Id == delItem.ID);
1105
                        }
1106
                    }
1107
                    else //delete, cut, 
1108
                    {
1109
                        MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(CommentID));
1110
                    }                    
1111
                    break;
1112 39f0624f ljiyeon
                case Event_Type.Thumb://이동 회전
1113 4eb052e4 ljiyeon
                    MarkupInfoSmallList.RemoveAll(p => p.Id.Equals(res.CommentID));
1114
                    MarkupInfoSmallList.Add(new MarkupInfoItemSmall
1115
                    {
1116
                        Id = res.CommentID,
1117
                        Data = res.ConvertData,
1118
                        Data_Type = res.DATA_TYPE,
1119
                        PageNumber = CurrentPage.PageNumber,
1120
                        UserID = App.ViewInfo.UserID,
1121
                        UserName = App.UserName,
1122
                    });
1123
                    break;
1124
                default:
1125
                    break;
1126
            }
1127
1128 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1129
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
1130 4eb052e4 ljiyeon
1131 39f0624f ljiyeon
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList();                 }            
1132 4eb052e4 ljiyeon
1133 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
1134
1135
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();            
1136 4eb052e4 ljiyeon
           
1137
            commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
1138 39f0624f ljiyeon
            commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d => d).ToList();            
1139 4eb052e4 ljiyeon
        }
1140
1141 787a4489 KangIngu
        private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e)
1142
        {
1143 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
1144 2089959a taeseongkim
            txtSearch.Text = string.Empty;
1145 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1146
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
1147 4eb052e4 ljiyeon
1148 39f0624f ljiyeon
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); }
1149 4eb052e4 ljiyeon
1150 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
1151 4eb052e4 ljiyeon
1152 39f0624f ljiyeon
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1153 787a4489 KangIngu
        }
1154
1155
        private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e)
1156
        {
1157 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
1158 2089959a taeseongkim
            txtSearch.Text = string.Empty;
1159 4eb052e4 ljiyeon
1160 39f0624f ljiyeon
            List<MarkupInfoItemSmall> TempMarkupInfoSmallList = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1161
            if (commentType.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(commentType.SelectedValue)).ToList(); }
1162 4eb052e4 ljiyeon
1163 39f0624f ljiyeon
            if (commentUser.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.UserName == ((IKCOM.MarkupInfoItem)commentUser.SelectedValue).UserName).ToList(); }
1164 4eb052e4 ljiyeon
1165 39f0624f ljiyeon
            if (commentPage.SelectedValue != null) { TempMarkupInfoSmallList = TempMarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(commentPage.SelectedValue)).ToList(); }
1166 4eb052e4 ljiyeon
1167 39f0624f ljiyeon
            MarkupList.ItemsSource = TempMarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
1168 787a4489 KangIngu
        }
1169
1170
        private void btnPanorama_Click(object sender, RoutedEventArgs e)
1171
        {
1172
            ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow();
1173
        }
1174 79f3f21a djkim
1175
        private void btnSearch_Click(object sender, RoutedEventArgs e)
1176
        {
1177 2089959a taeseongkim
            string search_str = txtSearch.Text;
1178
1179
            if(string.IsNullOrWhiteSpace(search_str))
1180
            {
1181
                return;
1182
            }
1183
1184 79f3f21a djkim
            var sel_type = commentType.SelectedItem;
1185
            var sel_user = commentUser.SelectedItem;
1186
            var sel_page = commentPage.SelectedItem;
1187
            List<MarkupInfoItemSmall> small_list = new List<MarkupInfoItemSmall>();
1188
            List<MarkupInfoItemSmall> list = MarkupInfoSmallList;
1189 90e7968d ljiyeon
            if (sel_page != null)
1190 79f3f21a djkim
            {
1191
                list = list.Where(d => d.PageNumber == Convert.ToInt32(sel_page)).ToList();
1192
            }
1193 90e7968d ljiyeon
            if (sel_type != null)
1194 79f3f21a djkim
            {
1195
                list = list.Where(d => d.Data_Type == Convert.ToInt32(sel_type)).ToList();
1196
            }
1197
            if (sel_user != null)
1198
            {
1199
                list = list.Where(d => d.UserID == (sel_user as MarkupInfoItem).UserID).ToList();
1200
            }
1201
            foreach (var item in list)
1202
            {
1203
                var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(item.Data.ToString());
1204 90e7968d ljiyeon
1205 79f3f21a djkim
                switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), item.Data_Type.ToString()))
1206 90e7968d ljiyeon
                {
1207 79f3f21a djkim
                    case MarkupToPDF.Controls.Common.ControlType.TextControl:
1208
                    case MarkupToPDF.Controls.Common.ControlType.TextBorder:
1209
                    case MarkupToPDF.Controls.Common.ControlType.TextCloud:
1210
                        {
1211
                            MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
1212 2089959a taeseongkim
1213
                            if (!string.IsNullOrWhiteSpace(instance.Text))
1214 90e7968d ljiyeon
                            {
1215 2089959a taeseongkim
                                if (instance.Text.ToLower().Contains(search_str.ToLower()))
1216
                                {
1217
                                    small_list.Add(item);
1218
                                }
1219 79f3f21a djkim
                            }
1220
                        }
1221
                        break;
1222
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextBorderControl:
1223
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextCloudControl:
1224
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTextControl:
1225
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextBorderControl:
1226
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextCloudControl:
1227
                    case MarkupToPDF.Controls.Common.ControlType.ArrowTransTextControl:
1228
                        {
1229
                            MarkupToPDF.Serialize.S_Control.S_ArrowTextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_ArrowTextControl>(data);
1230 2089959a taeseongkim
1231
                            if (!string.IsNullOrWhiteSpace(instance.ArrowText))
1232 79f3f21a djkim
                            {
1233 2089959a taeseongkim
                                if (instance.ArrowText.Contains(search_str))
1234
                                {
1235
                                    small_list.Add(item);
1236
                                }
1237 79f3f21a djkim
                            }
1238
                        }
1239
                        break;
1240
                }
1241
            }
1242 90e7968d ljiyeon
1243 39f0624f ljiyeon
            MarkupList.ItemsSource = null;
1244
            MarkupList.ItemsSource = small_list.OrderBy(d => d.PageNumber).ToList();
1245 2089959a taeseongkim
        }
1246
1247
        private void TxtSearch_KeyDown(object sender, KeyEventArgs e)
1248
        {
1249
            if(e.Key == Key.Enter || e.Key == Key.Return)
1250
            {
1251
                btnSearch_Click(sender, new RoutedEventArgs());
1252
            }
1253 79f3f21a djkim
        }
1254 787a4489 KangIngu
    }
1255
}
클립보드 이미지 추가 (최대 크기: 500 MB)