프로젝트

일반

사용자정보

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

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

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