프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (34.3 KB)

1
using IKCOM;
2
using KCOM.Common;
3
using KCOMDataModel.DataModel;
4
using System;
5
using System.Collections.Generic;
6
using System.Collections.ObjectModel;
7
using System.ComponentModel;
8
using System.Diagnostics;
9
using System.Linq;
10
using System.Windows;
11
using System.Windows.Controls;
12
using System.Windows.Input;
13
using Telerik.Windows.Controls;
14

    
15
namespace KCOM.Controls
16
{
17
    /// <summary>
18
    /// Interaction logic for PageNavigator.xaml
19
    /// </summary>
20
    public partial class Sample : UserControl, INotifyPropertyChanged
21
    {
22
        public List<FAVORITE_DOC> _FavoriteSet { get; set; }
23
        public event PropertyChangedEventHandler PropertyChanged;
24
        public Sample()
25
        {
26
            //InitializeComponent();            
27
            this.Loaded += Sample_Loaded;
28
            //_Initialize = true;
29
            
30
            //lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged);
31
            //ImgListbox.MouseDoubleClick += ImgListbox_MouseDoubleClick;
32
        }
33

    
34
        private void Sample_Loaded(object sender, RoutedEventArgs e)
35
        {
36
            //측정
37
            //Stopwatch sw = new Stopwatch();
38
            //sw.Start();
39
            InitializeComponent();
40
            //System.Diagnostics.Debug.WriteLine("Sample() : " + sw.ElapsedMilliseconds.ToString() + "ms");
41

    
42
            _Initialize = true;
43
            lstSelectComment.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(lstSelectComment_SelectionChanged);
44
            
45
        }
46

    
47
        //private void ImgListbox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
48
        //{
49

    
50
        //    if (ImgListbox.SelectedItem !=null && (ImgListbox.SelectedItem as ThumbnailItem).PageNumber == CurrentPage.PageNumber)
51
        //    {
52
        //        this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ScaleToFit();
53
        //    }
54
        //}
55

    
56
        public ObservableCollection<ThumbnailItem> _thumbnailItems;
57
        private List<DOCPAGE> _PageList = null;
58
        private string _DefaultUri = null;
59
        public ThumbnailItem CurrentPage = null;
60
        public ThumbnailItem _NextPage = null;
61
        public int PageCount = 0;
62

    
63
        private bool _Initialize;
64
        public event EventHandler<PageChangeEventArgs> PageChanged;
65
        public event EventHandler<PageChangeEventArgs> PageChanging;
66
        List<UsersCommentPagesMember> _UsersCommentPagesList = new List<UsersCommentPagesMember>();
67
        public class PageChangeEventArgs : EventArgs
68
        {
69
            public DOCPAGE CurrentPage { get; set; }
70
            public string PageUri { get; set; }
71
            public int PageNumber { get; set; }
72
        }
73

    
74
        private bool _IsFitOn { get; set; }
75
        public bool IsFitOn
76
        {
77
            get
78
            {
79
                return _IsFitOn;
80
            }
81
            set
82
            {
83
                _IsFitOn = value;
84
                RaisePropertyChanged("IsFitOn");
85
            }
86
        }
87

    
88
        public void RaisePropertyChanged(string propName)
89
        {
90
            if (PropertyChanged != null)
91
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
92
        }
93

    
94
        public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri)
95
        {
96
            this._PageList = PageList;
97
            this._DefaultUri = DefaultUri;
98
            ThumbnailSet();
99
            this.PageCount = PageList.Count();
100
            //ThumbNmailSet();
101
            rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked);
102
            rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked);
103
            expCommentPages.PreviewCollapsed += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewCollapsed);
104
            expCommentPages.PreviewExpanded += new Telerik.Windows.RadRoutedEventHandler(expCommentPages_PreviewExpanded);
105
        }
106
        void rdoCommented_Checked(object sender, RoutedEventArgs e)
107
        {
108
            if (rdoAllPages.IsChecked == true) expCommentPages.IsExpanded = false;
109
            SetCommentPages();
110
        }
111

    
112
        void rdoFavoritePages_Checked(object sender, RoutedEventArgs e)
113
        {
114
            if (rdoFavoritePages.IsChecked == true)
115
                expCommentPages.IsExpanded = false;
116

    
117
            _FavoriteSet = _FavoriteSet == null ? new List<FAVORITE_DOC>() : _FavoriteSet; 
118
            if (_FavoriteSet.Count > 0)
119
            {
120
                SetCommentPages_Favorite(); //수정    
121
            }
122
            else
123
            {
124
                rdoAllPages.IsChecked = true;
125
                rdoFavoritePages.IsChecked = false;
126
            }
127
        }
128

    
129
        private void SetCommentPages_Favorite()
130
        {
131
            ThumbnailSet();
132
            //_UsersCommentPagesList
133
            //var result = (from A in _UsersCommentPagesList
134
            //              from B in _FavoriteSet
135
            //              where A.PageNumber.Contains(B.PageNo)
136
            //              select A).ToList();
137
            //_UsersCommentPagesList = result;
138

    
139
            SetCommentPages();
140

    
141
        }
142

    
143
        void expCommentPages_PreviewCollapsed(object sender, Telerik.Windows.RadRoutedEventArgs e)
144
        {
145
            //txtThumbCount.Visibility = Visibility.Collapsed;            
146
        }
147

    
148
        void expCommentPages_PreviewExpanded(object sender, Telerik.Windows.RadRoutedEventArgs e)
149
        {
150
            rdoAllPages.IsChecked = false;
151
            rdoFavoritePages.IsChecked = false;
152
            //txtThumbCount.Visibility = Visibility.Visible;
153
            SetCommentPages();
154
        }
155

    
156
        private void ImgListbox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
157
        {
158
            if (ImgListbox.SelectedItem != null)
159
            {
160
                int _PageNo = -1;
161

    
162
                if (this.CurrentPage != null)
163
                {
164
                    _PageNo = this.CurrentPage.PageNumber;
165
                };
166

    
167
                if (_PageNo != ((ImgListbox.SelectedItem as ThumbnailItem).PageNumber))
168
                {
169
                    var _page = this._thumbnailItems.Where(item => item.PageNumber == (ImgListbox.SelectedItem as ThumbnailItem).PageNumber);
170
                    if (_page.Count() > 0)
171
                    {
172
                        ThumbnailItem _item = _page.First();
173
                        setPageChange(_item);
174
                    }
175
                }
176
            }
177
        }
178

    
179
        public bool GotoPageFlag = false;
180

    
181
        /// <summary>
182
        /// 해당 썸네일로 이동
183
        /// </summary>
184
        /// <param name="_pageNumber"></param>
185
        public void GotoPage(int _pageNumber)
186
        {
187
            int _PageNo = -1;
188
            if (int.TryParse(_pageNumber.ToString(), out _PageNo))
189
            {
190
                var _page = _thumbnailItems.Where(item => item.PageNumber == _PageNo);
191
                if (_page.Count() > 0)
192
                {
193
                    ThumbnailItem _item = _page.First();
194
                    setPageChange(_item);
195
                    this.ImgListbox.SelectedIndex = _pageNumber - 1;
196
                    this.ImgListbox.ScrollIntoView(_pageNumber - 1);
197
                }
198
            }
199
        }
200

    
201
        public void setPageChange(ThumbnailItem thumbnailItem)
202
        {
203
            if (thumbnailItem != null)
204
            {
205
                if (PageChanging != null)
206
                {
207
                    //강인구 수정(페이지가 같을 경우 이동 안함)
208
                    if (CurrentPage != null && CurrentPage == thumbnailItem)
209
                    {
210
                        return;
211
                    }
212

    
213
                    this.CurrentPage = _NextPage;
214
                    _NextPage = thumbnailItem;
215
                    PageChanging(this, new PageChangeEventArgs
216
                    {
217
                        CurrentPage = _PageList.Where(p => p.PAGE_NUMBER == thumbnailItem.PageNumber).First(),
218
                        PageNumber = Convert.ToInt32(thumbnailItem.PageNumber),
219
                        PageUri = null
220
                    });
221
                }
222
            }
223
        }
224

    
225
        public void SetNextPage()
226
        {  
227
            CurrentPage = _NextPage;
228
            PageChange(_NextPage);
229
        }
230

    
231
        private void PageChange(ThumbnailItem thumbitem)
232
        {
233
            if (PageChanged != null)
234
            {
235
                var uri = _DefaultUri.Replace("{PageNo}", thumbitem.PageNumber.ToString());
236
                //var _thumbitem = _thumbnailItems.Where(item => item.PageNumber == DocPage.PageNumber).First();
237
                var _itemIndex = _thumbnailItems.IndexOf(thumbitem);
238
                //ImgListbox.SelectedItem(_thumbitem, true);
239
                ImgListbox.SelectedItem = thumbitem;
240

    
241
                if (_itemIndex < _thumbnailItems.Count() - 1)
242
                    ImgListbox.ScrollIntoView(_itemIndex);
243
                else
244
                    ImgListbox.ScrollIntoView(_thumbnailItems.Count() - 1);
245

    
246
                //txtCurentPageNo.Text = (_itemIndex + 1).ToString();
247

    
248
                //txtCurentPageNo.Text = this.CurrentPage.PageNumber.ToString();
249

    
250
                var _DocPages = _PageList.Where(p => p.PAGE_NUMBER == thumbitem.PageNumber);
251

    
252
                if (_DocPages.Count() > 0)
253
                {   
254
                    var _page = _DocPages.First();
255

    
256
                    PageChanged(this, new PageChangeEventArgs
257
                    {
258
                        CurrentPage = _page,
259
                        PageUri = uri,
260
                        PageNumber = thumbitem.PageNumber
261
                    });
262
                    ImgListbox.SelectedItem = thumbitem;
263

    
264
                }
265
                else
266
                {
267
                    //System.Diagnostics.Debug.WriteLine("페이지 정보가 없습니다");
268
                }
269
            }
270
        }
271

    
272
        void lstSelectComment_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
273
        {
274
            SetCommentPages();
275
        }
276

    
277

    
278
        void user_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
279
        {
280
            SetCommentPages();
281
            //System.Diagnostics.Debug.WriteLine(e.PropertyName);
282
        }
283
        public void SetCommentPages()
284
        {
285
            ThumbnailSet();
286
            SetCommentList(_UsersCommentPagesList.ToList());
287
        }
288

    
289
        public void SetCommentList(List<UsersCommentPagesMember> UsersCommentPagesList)
290
        {
291
            #region 기존 색상 제거 작업
292
            foreach (var item in this._thumbnailItems)
293
            {
294
                item.DisplayColorItems.Clear();
295
            } 
296
            #endregion
297

    
298

    
299

    
300
            List<UsersCommentPagesMember> _delItem = new List<UsersCommentPagesMember>();
301

    
302
            _UsersCommentPagesList.ToList().ForEach(item =>
303
            {
304
                var _comm = UsersCommentPagesList.Where(a => a.MarkupInfoID == item.MarkupInfoID);
305

    
306
                if (_comm.Count() == 0)
307
                {
308
                    _delItem.Add(item);
309
                }
310
            });
311

    
312
            _delItem.ForEach(f => _UsersCommentPagesList.Remove(f));
313

    
314
            UsersCommentPagesList.ForEach(user =>
315
            {
316
                user.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
317
                user.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(user_PropertyChanged);
318

    
319
                var _commLst = _UsersCommentPagesList.Where(o => o.MarkupInfoID == user.MarkupInfoID);
320

    
321
                if (_commLst.Count() == 0)
322
                {
323
                    _UsersCommentPagesList.Add(user);
324
                }
325
                else
326
                {
327
                    if (_commLst.First().PageNumber != user.PageNumber)
328
                        _commLst.First().PageNumber = user.PageNumber;
329
                }
330

    
331
                user.PageNumber.ForEach(page =>
332
                {
333
                    var _items = this._thumbnailItems.Where(item => item.PageNumber == page);
334

    
335
                    if (_items.Count() > 0)
336
                        _items.First().DisplayColorItems.Add(new SetColorMarkupItem { DisplayColor = user.SetColor });
337
                });
338
            });
339

    
340

    
341

    
342
            var data = _UsersCommentPagesList.OrderByDescending(p => p.isConSolidation == Convert.ToInt32(true)).ToList();
343
            if (data.Count() != 0)
344
            {
345
                if (Convert.ToBoolean(data.First().isConSolidation))
346
                {
347
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().UserName = "Consolidated";
348
                    data.Where(p => p.isConSolidation == Convert.ToInt32(true)).FirstOrDefault().Depart = "";
349
                    this.lstSelectComment.ItemsSource = data;
350
                }
351
                else
352
                {
353
                    this.lstSelectComment.ItemsSource = _UsersCommentPagesList;  //섬네일   
354
                }
355
            }
356
            else
357
            {
358
                this.lstSelectComment.ItemsSource = _UsersCommentPagesList;  //섬네일   
359
            }
360
            //this.ImgListbox.ItemsSource = null;
361
            this.ImgListbox.ItemsSource = this._thumbnailItems;
362
            var template = this.ImgListbox.ItemTemplate;
363
            this.ImgListbox.ItemTemplate = null;
364
            this.ImgListbox.ItemTemplate = template;
365
            this.ImgListbox.UpdateLayout();
366
        }
367

    
368
        private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
369
        {
370

    
371
        }
372
        private void ThumbnailSet()
373
        {
374
            if (!_Initialize) return;
375

    
376
            this._thumbnailItems = new ObservableCollection<ThumbnailItem>();
377
            List<int> _selectComment = new List<int>();
378
            if (this.lstSelectComment.ItemsSource != null)
379
            {
380
                var _pages = from commentPage in this.lstSelectComment.ItemsSource.Cast<UsersCommentPagesMember>()
381
                             where commentPage.IsSelected == true
382
                             select commentPage.PageNumber;
383

    
384
                foreach (var item in _pages)
385
                {
386
                    item.ForEach(pp => _selectComment.Add(pp));
387
                }
388

    
389
                _selectComment.Distinct();
390
            }
391

    
392
            var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0");
393
            this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList();
394
            //this._PageList.ForEach(page =>
395
            ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page =>
396
            {
397
                var _pageNo = page.PAGE_NUMBER;
398
                bool _addFlag = false;
399

    
400
                if (rdoFavoritePages.IsChecked == false)
401
                {
402
                    if (_selectComment.Count() > 0)
403
                    {
404
                        if ((rdoAllPages.IsChecked == true)
405
                            || (expCommentPages.IsExpanded == true && _selectComment.Where(s => s == _pageNo).Count() > 0))
406
                        {
407
                            _addFlag = true;
408
                        }
409
                    }
410
                    else
411
                    {
412
                        //if (App.ViewInfo.IsCustomPage)
413
                        //{
414
                        //    //_addFlag = false;
415

    
416
                        //    //App.ViewInfo.IsCustomPage = false;
417
                        //    //this.rdoAllPages.Visibility = System.Windows.Visibility.Collapsed;
418
                        //    //this.lstSelectComment.Visibility = System.Windows.Visibility.Collapsed;
419
                        //    this.rdoAllPages.IsChecked = false;
420
                        //    this.rdoFavoritePages.IsChecked = true;
421
                        //    //SetCommentPages();                        
422
                        //}
423
                        //else
424
                        //{
425
                        _addFlag = true;
426
                        //}
427
                    }
428
                }
429

    
430

    
431
                if(_addFlag)
432
                {
433
                    this._thumbnailItems.Add(new ThumbnailItem
434
                    {
435
                        ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
436
                        PageNumber = _pageNo,
437
                        Angle = page.PAGE_ANGLE,
438
                    });
439
                }
440
                else
441
                {
442
                    if ((rdoFavoritePages.IsChecked == true) && _FavoriteSet.Where(data => data.PAGE_NO == _pageNo).FirstOrDefault() != null)
443
                    {
444
                        this._thumbnailItems.Add(new ThumbnailItem
445
                        {
446
                            ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
447
                            PageNumber = _pageNo,
448
                            Angle = page.PAGE_ANGLE,
449
                        });
450
                    }
451
                }
452

    
453

    
454

    
455
                //this._thumbnailItems.Add(new ThumbnailItem
456
                //{
457
                //    ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
458

    
459
                //    //ImageUri = new Uri(@"http://www.honeyhead.net/Pages/000000/111111/11111111/1.cmp"),
460

    
461
                //    //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"),
462
                //    //DisplayColorItems = pageColor,
463
                //    PageNumber = Convert.ToInt32(_pageNo),
464
                //    Angle = Convert.ToInt32(page.PAGE_ANGLE),
465
                //});
466
            });
467

    
468
            //txtTotPageNo.Text = this._PageList.Count().ToString();
469

    
470
            //txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString());
471

    
472
            if (ImgListbox.ItemsSource == null)
473
            {
474
                ImgListbox.ItemsSource = this._thumbnailItems;
475

    
476
                this._thumbnailItems.ToList().ForEach(data =>
477
                {
478
                    data.Width = ImgListbox.ActualWidth;
479
                });
480

    
481
                if (ImgListbox.Items.Count > 0)
482
                {
483
                    //int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1;
484
                    int StartPageIdx = 1;
485
                    //if (App.ViewInfo.IsCustomPage)
486
                    //{
487
                    //    ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault();
488
                    //}
489
                    //else
490
                    //{
491

    
492
                    if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1)
493
                    {
494
                        ImgListbox.SelectedItem = ImgListbox.Items[0];
495
                    }
496
                    else
497
                    {
498
                        ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx];
499
                    }
500
                    //}
501
                }
502
            }
503
            else
504
            {
505
                ImgListbox.UpdateLayout();
506
                ImgListbox.ItemsSource = this._thumbnailItems;
507
            }
508
        }
509

    
510
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
511
        {
512
            if (e.ClickCount >= 2)
513
            {
514
                var selectItem = gogogo.SelectedItem as IKCOM.MarkupItem;
515
                GotoPage(selectItem.PageNumber);
516
                MarkupToPDF.Controls.Parsing.LayerControl control = new MarkupToPDF.Controls.Parsing.LayerControl();
517
                var result = control.markupParse_GetBaseControl(selectItem.Data);
518
                Rect rect = new Rect(new Point(result.StartPoint.X-100, result.StartPoint.Y-100), new Point(result.EndPoint.X + 100, result.EndPoint.Y + 100));             
519
                this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
520
                //bool isGO = false;
521

    
522
                //var imageViewer = this.ParentOfType<KCOM.Views.MainMenu>().imageViewer;
523
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Fit;
524
                //imageViewer.InteractiveMode = Leadtools.Windows.Controls.InteractiveMode.UserRectangle;
525
                //imageViewer.InteractiveUserRectangle += (sen, ea) =>
526
                //{
527
                //    System.Diagnostics.Debug.WriteLine(ea.Bounds);
528
                //    if (ea.Status == Leadtools.Windows.Controls.InteractiveModeStatus.End)
529
                //    {
530
                //        this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(ea.Bounds);                        
531
                //    }
532

    
533
                //};
534
                //imageViewer.SizeMode = Leadtools.Windows.Controls.SizeMode.Normal;
535

    
536
                //GotoPage(gogogo.SelectedItem as MarkupList)
537
            }
538
        }
539

    
540
        private void commentUser_SelectionChanged(object sender, SelectionChangedEventArgs e)
541
        {
542
            if (e.AddedItems.Count > 0)
543
            {
544
                if (commentUser.Items.Count > 0)
545
                {
546
                    MarkupInfoSmallList.Clear();
547
                    //var d = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First();
548
                    //d.PageNumber
549

    
550
                    //e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList.First().
551
                    //gogo.DataContext = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList;
552

    
553
                    //gogogo.ItemsSource = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault().MarkupList;
554
                    //gogogo.ItemsSource = ViewerDataModel.Instance._markupInfoList.Where(d=>d.UserName ==  sender as RadCombo
555

    
556
                    var temp = e.AddedItems.Cast<MarkupInfoItem>().FirstOrDefault();
557
                    temp.MarkupList.ForEach(d =>
558
                    {
559
                        MarkupInfoSmallList.Add(new MarkupInfoItemSmall
560
                        {
561
                            Data = d.Data,
562
                            Data_Type = d.Data_Type,
563
                            PageNumber = d.PageNumber,
564
                            UserID = temp.UserID,
565
                            UserName = temp.UserName,
566
                        });
567
                    });
568
                    gogogo.ItemsSource = null;
569
                    gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
570
                }                
571
            }
572
            else
573
            {
574
                MarkupInfoSmallList.Clear();
575
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
576
                {
577
                    d.MarkupList.ForEach(b =>
578
                    {
579
                        MarkupInfoSmallList.Add(new MarkupInfoItemSmall
580
                        {
581

    
582
                            Data = b.Data,
583
                            Data_Type = b.Data_Type,
584
                            PageNumber = b.PageNumber,
585
                            UserID = d.UserID,
586
                            UserName = d.UserName,
587
                        });
588
                    });
589
                });
590
                gogogo.ItemsSource = null;
591
                gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); 
592
            }
593
        }
594

    
595
        public class MarkupInfoItemSmall
596
        {
597
            public string Id { get; set; }
598
            public string UserName { get; set; }
599
            public string UserID { get; set; }
600
            public int PageNumber { get; set; }
601
            public string Data { get; set; }
602
            public int Data_Type { get; set; }
603
        }
604

    
605
        private List<MarkupInfoItemSmall> _MarkupInfoSmallList { get; set; }
606
        public List<MarkupInfoItemSmall> MarkupInfoSmallList
607
        {
608
            get
609
            {
610
                if (_MarkupInfoSmallList == null)
611
                {
612
                    _MarkupInfoSmallList = new List<MarkupInfoItemSmall>();
613
                }
614
                return _MarkupInfoSmallList;
615
            }
616
            set
617
            {
618
               
619
                _MarkupInfoSmallList = value;
620
                RaisePropertyChanged("MarkupInfoSmallList");
621
            }
622
        }
623

    
624
        /// <summary>
625
        /// goto page and select item selected by user
626
        /// </summary>
627
        /// <param name="sender"></param>
628
        /// <param name="e"></param>
629
        private void RadButton_Click(object sender, RoutedEventArgs e)
630
        {
631
            var clickButtonItem = sender as RadButton;
632
            if (clickButtonItem != null && clickButtonItem.CommandParameter != null)
633
            {
634
                try
635
                {
636
                    Rect rect = new Rect();
637
                    Point s_point = new Point();
638
                    Point e_point = new Point();
639

    
640
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
641
                    GotoPage(Convert.ToInt32(gaza.PageNumber));
642

    
643
                    var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업
644
                    switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString()))
645
                    {
646
                        case MarkupToPDF.Controls.Common.ControlType.TextControl:
647
                            {
648
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
649
                                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));
650
                            }
651
                            break;
652
                        case MarkupToPDF.Controls.Common.ControlType.TextBorder:
653
                            {
654
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
655
                                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));
656
                            }
657
                            break;
658
                        case MarkupToPDF.Controls.Common.ControlType.TextCloud:
659
                            {
660
                                MarkupToPDF.Serialize.S_Control.S_TextControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_TextControl>(data);
661
                                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));
662
                            }
663
                            break;
664
                        case MarkupToPDF.Controls.Common.ControlType.PolygonControl:
665
                            {
666
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
667

    
668
                                foreach (Point A in instance.PointSet)
669
                                {
670
                                    if (s_point == new Point())
671
                                    {
672
                                        s_point = A;
673
                                        e_point = A;
674
                                    }
675
                                    s_point.X = Math.Min(s_point.X, A.X);
676
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
677
                                    e_point.X = Math.Max(e_point.X, A.X);
678
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
679
                                }
680
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
681
                            }
682
                            break;
683
                        case MarkupToPDF.Controls.Common.ControlType.PolygonCloud:
684
                            {
685
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
686

    
687
                                foreach (Point A in instance.PointSet)
688
                                {
689
                                    if (s_point == new Point())
690
                                    {
691
                                        s_point = A;
692
                                        e_point = A;
693
                                    }
694
                                    s_point.X = Math.Min(s_point.X, A.X);
695
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
696
                                    e_point.X = Math.Max(e_point.X, A.X);
697
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
698
                                }
699
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
700
                            }
701
                            break;
702
                        case MarkupToPDF.Controls.Common.ControlType.ChainLine:
703
                            {
704
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
705

    
706
                                foreach (Point A in instance.PointSet)
707
                                {
708
                                    if (s_point == new Point())
709
                                    {
710
                                        s_point = A;
711
                                        e_point = A;
712
                                    }
713
                                    s_point.X = Math.Min(s_point.X, A.X);
714
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
715
                                    e_point.X = Math.Max(e_point.X, A.X);
716
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
717
                                }
718
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
719
                            }
720
                            break;
721
                        case MarkupToPDF.Controls.Common.ControlType.Ink:
722
                            {
723
                                MarkupToPDF.Serialize.S_Control.S_BaseControl instance = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
724

    
725
                                foreach (Point A in instance.PointSet)
726
                                {
727
                                    if (s_point == new Point())
728
                                    {
729
                                        s_point = A;
730
                                        e_point = A;
731
                                    }
732
                                    s_point.X = Math.Min(s_point.X, A.X);
733
                                    s_point.Y = Math.Min(s_point.Y, A.Y);
734
                                    e_point.X = Math.Max(e_point.X, A.X);
735
                                    e_point.Y = Math.Max(e_point.Y, A.Y);
736
                                }
737
                                rect = new Rect(new Point(s_point.X - 100, s_point.Y - 100), new Point(e_point.X + 100, e_point.Y + 100));
738
                            }
739
                            break;
740
                        default:
741
                            MarkupToPDF.Serialize.S_Control.S_BaseControl item = MarkupToPDF.Serialize.Core.JsonSerializerHelper.JsonDeserialize<MarkupToPDF.Serialize.S_Control.S_BaseControl>(data);
742
                            rect = new Rect(new Point(item.StartPoint.X - 100, item.StartPoint.Y - 100), new Point(item.EndPoint.X + 100, item.EndPoint.Y + 100));
743
                            break;
744
                    }
745

    
746
                    this.ParentOfType<KCOM.Views.MainMenu>().SelecteItemByRect(rect);
747
                    this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
748
                }
749
                catch (Exception ex)
750
                {
751
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
752
                }
753
            }
754
        }
755

    
756
        private void gogogo_Loaded(object sender, RoutedEventArgs e)
757
        {
758
            if (MarkupInfoSmallList.Count == 0)
759
            {
760
                ViewerDataModel.Instance._markupInfoList.ToList().ForEach(d =>
761
                {
762
                    if (d.MarkupList != null)
763
                    {
764
                        d.MarkupList.ForEach(b =>
765
                        {
766
                            MarkupInfoSmallList.Add(new MarkupInfoItemSmall
767
                            {
768
                                Id = b.ID,
769
                                Data = b.Data,
770
                                Data_Type = b.Data_Type,
771
                                PageNumber = b.PageNumber,
772
                                UserID = d.UserID,
773
                                UserName = d.UserName,
774
                            });
775
                        });
776
                    }
777
                });
778
                gogogo.ItemsSource = null;
779
                gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList(); ;
780

    
781
                commentPage.ItemsSource = MarkupInfoSmallList.Select(d => d.PageNumber).Distinct().OrderBy(d=>d).ToList();
782
                commentType.ItemsSource = MarkupInfoSmallList.Select(d => d.Data_Type).Distinct().OrderBy(d => d).ToList();
783
            }
784
        }
785

    
786
        private void commentType_SelectionChanged(object sender, SelectionChangedEventArgs e)
787
        {
788
            gogogo.ItemsSource = null;
789
            if (e.AddedItems.Count >0)
790
            {
791
                
792
                gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.Data_Type == Convert.ToInt32(e.AddedItems[0])).ToList();
793
            }
794
            else
795
            {
796
                gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
797
            }
798
        }
799

    
800
        private void commentPage_SelectionChanged(object sender, SelectionChangedEventArgs e)
801
        {
802
            gogogo.ItemsSource = null;
803
            if (e.AddedItems.Count > 0)
804
            {
805
                gogogo.ItemsSource = MarkupInfoSmallList.Where(d => d.PageNumber == Convert.ToInt32(e.AddedItems[0])).ToList();
806
            }
807
            else
808
            {
809
                gogogo.ItemsSource = MarkupInfoSmallList.OrderBy(d => d.PageNumber).ToList();
810
            }
811
        }
812

    
813
        private void btnPanorama_Click(object sender, RoutedEventArgs e)
814
        {
815
            ViewerDataModel.Instance.SystemMain.dzTopMenu.PanoramaShow();
816
        }
817
    }
818
}
클립보드 이미지 추가 (최대 크기: 500 MB)