프로젝트

일반

사용자정보

개정판 54a28343

ID54a283437aead516546aa61b4f0e99ea888b1e4c
상위 87d56836
하위 d97dbc7f

김태성이(가) 약 5년 전에 추가함

Thumbnail 로딩 방식 수정

Change-Id: Iad91569fc06e4eecfe9d5a7a9ece9567ad161874

차이점 보기:

KCOM/Controls/Sample.xaml.cs
9 9
using System.ComponentModel;
10 10
using System.Diagnostics;
11 11
using System.Linq;
12
using System.Threading.Tasks;
12 13
using System.Windows;
13 14
using System.Windows.Controls;
14 15
using System.Windows.Input;
......
25 26
    {
26 27
        public List<FAVORITE_DOC> _FavoriteSet { get; set; }
27 28
        public event PropertyChangedEventHandler PropertyChanged;
29

  
30
        PageManager.PageStorage samplePageStorage;
31

  
28 32
        public Sample()
29 33
        {
30 34
            InitializeComponent();
......
55 59
        public ThumbnailItem CurrentPage = null;
56 60
        public int PageCount = 0;
57 61
        private bool _Initialize;
62

  
63
        public event EventHandler<EventArgs> ThumbInitialized;
58 64
        public event EventHandler<PageChangeEventArgs> PageChanged;
59 65
        public event EventHandler<PageChangeEventArgs> PageChanging;
60 66

  
......
98 104
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
99 105
        }
100 106

  
101
        public void SetPageNavi(List<DOCPAGE> PageList, string DefaultUri)
107
        public async Task SetPageNaviAsync(List<DOCPAGE> PageList, string DefaultUri)
102 108
        {
103 109
            this._PageList = PageList;
104 110
            this._DefaultUri = DefaultUri;
105
            ThumbnailSet();
111

  
112
            string tempStoragePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "MARKUS", System.IO.Path.GetRandomFileName());
113

  
114
            samplePageStorage = new PageManager.PageStorage(_DefaultUri, tempStoragePath,"jpg", _PageList.Count(), _PageList.Count());
115

  
116
            await ThumbnailSetAsync();
117
            
106 118
            this.PageCount = PageList.Count();
119

  
107 120
            //ThumbNmailSet();
108 121
            rdoAllPages.Checked += new RoutedEventHandler(rdoCommented_Checked);
109 122
            rdoFavoritePages.Checked += new RoutedEventHandler(rdoFavoritePages_Checked);
......
136 149
            }
137 150
        }
138 151

  
139
        private void SetCommentPages_Favorite()
152
        private async void SetCommentPages_Favorite()
140 153
        {
141
            ThumbnailSet();            
154
            await ThumbnailSetAsync();            
142 155
            SetCommentPages();
143 156
        }
144 157

  
......
439 452
            //System.Diagnostics.Debug.WriteLine(e.PropertyName);
440 453
        }
441 454

  
442
        public void SetCommentPages()
455
        public async void SetCommentPages()
443 456
        {
444
            ThumbnailSet();
457
            await ThumbnailSetAsync();
445 458
            SetCommentList(UsersCommentPagesList.ToList());
446 459
        }
447 460

  
......
538 551

  
539 552
        }
540 553

  
541
        private void ThumbnailSet()
554
        private async Task ThumbnailSetAsync()
542 555
        {
543 556
            Logger.sendCheckLog("ThumbnailSet", 1);
544
            if (!_Initialize) return;
545

  
557
      
546 558
            this._thumbnailItems = new ObservableCollection<ThumbnailItem>();
547 559
            List<int> _selectComment = new List<int>();
548 560
            if (this.lstSelectComment.ItemsSource != null)
......
562 574
            var uri = _DefaultUri.Replace("{0}/{1}_{2}", "8/0_0");
563 575
            this._PageList = this._PageList.OrderBy(data => data.PAGE_NUMBER).ToList();
564 576
            //this._PageList.ForEach(page =>
565
            ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page =>
577

  
578
            var items = ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList();
579

  
580
            foreach (var page in items)
566 581
            {
582

  
583
            //}
584
            //ViewerDataModel.Instance.Document_Info.OrderBy(data => data.PAGE_NUMBER).ToList().ForEach(page =>
585
            //{
567 586
                var _pageNo = page.PAGE_NUMBER;
568 587
                bool _addFlag = false;
569 588

  
......
597 616
                    }
598 617
                }
599 618

  
619
                var pageUri = await samplePageStorage.GetPageUriAsync(_pageNo);
600 620

  
601 621
                if (_addFlag)
602 622
                {
603
                    this._thumbnailItems.Add(new ThumbnailItem
623
                    
624
                   this._thumbnailItems.Add(new ThumbnailItem
604 625
                    {
605
                        ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
626
                        ImageUri = pageUri,
606 627
                        PageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString()).Replace("jpg","png")),
607 628
                        PageNumber = _pageNo,
608 629
                        Angle = page.PAGE_ANGLE,
......
614 635
                    {
615 636
                        this._thumbnailItems.Add(new ThumbnailItem
616 637
                        {
617
                            ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
638
                            ImageUri = pageUri,
618 639
                            PageNumber = _pageNo,
619 640
                            Angle = page.PAGE_ANGLE,
620 641
                        });
621 642
                    }
622 643
                }
623

  
624

  
625

  
626
                //this._thumbnailItems.Add(new ThumbnailItem
627
                //{
628
                //    ImageUri = new Uri(uri.Replace("{PageNo}", _pageNo.ToString())),
629

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

  
632
                //    //ImageUri = new Uri(@"https://image.freepik.com/free-vector/abstract-logo-in-flame-shape_1043-44.jpg"),
633
                //    //DisplayColorItems = pageColor,
634
                //    PageNumber = Convert.ToInt32(_pageNo),
635
                //    Angle = Convert.ToInt32(page.PAGE_ANGLE),
636
                //});
637
            });
638

  
639
            //txtTotPageNo.Text = this._PageList.Count().ToString();
640

  
641
            //txtThumbCount.Text = String.Format("Count : {0}", (this._thumbnailItems.Count).ToString());
644
            }
642 645

  
643 646
            if (ImgListbox.ItemsSource == null)
644 647
            {
645 648
                ImgListbox.ItemsSource = this._thumbnailItems;
646 649

  
650
                this.CurrentPage = this._thumbnailItems.FirstOrDefault();
651

  
647 652
                this._thumbnailItems.ToList().ForEach(data =>
648 653
                {
649 654
                    data.Width = ImgListbox.ActualWidth;
......
652 657

  
653 658
                if (ImgListbox.Items.Count > 0)
654 659
                {
655
                    //int StartPageIdx = Convert.ToInt32(App.ViewInfo.StartPage) - 1;
656 660
                    int StartPageIdx = 1;
657
                    //if (App.ViewInfo.IsCustomPage)
658
                    //{
659
                    //    ImgListbox.SelectedItem = ImgListbox.Items.Where(data => (data as ThumbnailItem).PageNumber == Convert.ToInt32(App.ViewInfo.StartPage)).FirstOrDefault();
660
                    //}
661
                    //else
662
                    //{
663

  
661
                
664 662
                    if (StartPageIdx <= 0 || StartPageIdx > ImgListbox.Items.Count || StartPageIdx == 1)
665 663
                    {
666 664
                        ImgListbox.SelectedItem = ImgListbox.Items[0];
......
669 667
                    {
670 668
                        ImgListbox.SelectedItem = ImgListbox.Items[StartPageIdx];
671 669
                    }
672
                    //}
673 670
                }
674 671
            }
675 672
            else
......
677 674
                ImgListbox.UpdateLayout();
678 675
                ImgListbox.ItemsSource = this._thumbnailItems;
679 676
            }
677

  
678
            if(ThumbInitialized != null)
679
            {
680
                ThumbInitialized(this, new EventArgs());
681
            }
680 682
        }
681 683

  
682 684
        private async void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)