프로젝트

일반

사용자정보

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

markus / KCOM / Controls / Sample.xaml.cs @ 448c5399

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