프로젝트

일반

사용자정보

개정판 cdfb57ff

IDcdfb57ff4780f16447f02fb0203c397a3732c3cd
상위 dbc1e5b6
하위 96c13fad

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

zoom control 이벤트 추가
mainmenu 수정
app 수정

Change-Id: I0d007c3a3c412b7fbe6e2a52bafb932e1a7b9f03

차이점 보기:

KCOM/Views/MainMenu.xaml.cs
494 494
            //}
495 495
        }
496 496

  
497
        DispatcherTimer renderTesttimer;
498

  
497 499
        /// <summary>
498 500
        /// start page changing
499 501
        ///  - save controls if page is modified
......
501 503
        /// </summary>
502 504
        /// <param name="sender"></param>
503 505
        /// <param name="e"></param>
504
        private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
506
        private async void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e)
505 507
        {
506 508
            CompareMode.IsChecked = false;
507 509
            var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber;
......
524 526

  
525 527
            ViewerDataModel.Instance.PageNumber = BalancePoint;
526 528

  
527
            string uri = "";
528
            if (userData.COMPANY != "EXT")
529
            {
530
                uri = String.Format(CommonLib.Common.GetConfigString("mainServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, (Convert.ToUInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber);
531
            }
532
            else
533
            {
534
                uri = String.Format(CommonLib.Common.GetConfigString("subServerImageWebPath", "URL", "", App.isExternal), _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber);
535
            }
536

  
537 529
            var pageWidth = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
538 530
            var pageHeight = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
531
            var pageUri = pageNavigator.CurrentPage.PageUri;
532
            var contentScale = zoomAndPanControl.ContentScale;
539 533

  
540
            var defaultBitmapImage = new BitmapImage();
541
            defaultBitmapImage.BeginInit();
542
            defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
543
            defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
544
            defaultBitmapImage.UriSource = new Uri(uri);
545
            defaultBitmapImage.DecodePixelWidth = Convert.ToInt32(pageWidth );
546
            defaultBitmapImage.DecodePixelHeight = Convert.ToInt32(pageHeight);// * zoomAndPanControl.ContentScale
547
            defaultBitmapImage.EndInit();
534
            #region 이미지 로딩 수정
548 535

  
549
            ViewerDataModel.Instance.ImageViewPath = null;
550
            Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage Downloading", 1);
551
            if (defaultBitmapImage.IsDownloading)
552
            {
553
                Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage IsDownloading", 1);
554
                defaultBitmapImage.DownloadCompleted += (ex, arg) =>
555
                {                   
556
                    defaultBitmapImage.Freeze();                                        
557
                    ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
558
                    ViewerDataModel.Instance.ImageViewWidth = pageWidth;
559
                    ViewerDataModel.Instance.ImageViewHeight = pageHeight;
560
                    mainPanel.UpdateLayout();
561
                    this.pageNavigator.ChangePage(e.PageNumber); 
562
                    
563
                    //image dispose
564
                    defaultBitmapImage = null;
565
                    GC.Collect();
566
                };
567
            }
536
            ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth * contentScale, pageHeight * contentScale);
568 537

  
569
            zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH);
570
            zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT);
538
            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
539
            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
571 540

  
541
            zoomAndPanCanvas.Width = pageWidth;
542
            zoomAndPanCanvas.Height = pageHeight;
572 543

  
573
            Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width;
574
            Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height;
575
            inkBoard.Width = zoomAndPanCanvas.Width;
576
            inkBoard.Height = zoomAndPanCanvas.Height;
544
            Common.ViewerDataModel.Instance.ContentWidth = pageWidth;
545
            Common.ViewerDataModel.Instance.ContentHeight = pageHeight;
577 546

  
547
            inkBoard.Width = pageWidth;
548
            inkBoard.Height = pageHeight;
549

  
550
            #endregion
578 551

  
579 552
            if (!testPanel2.IsHidden)
580 553
            {
......
673 646
                tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint);
674 647
            }
675 648

  
649
            this.pageNavigator.ChangePage(e.PageNumber);
650
        }
651

  
652
        public async System.Threading.Tasks.Task<BitmapImage> GetDownloadImageAsync2(Uri uri,double pageWidth,double pageHeight)
653
        {
654
            BitmapImage defaultBitmapImage = new BitmapImage();
655

  
656
            using (System.Net.Http.HttpClient httpClient = new System.Net.Http.HttpClient())
657
            {
658
                using (var responseStream = await httpClient.GetStreamAsync(uri))
659
                {
660
                    using (var memoryStream = new System.IO.MemoryStream())
661
                    {
662
                        await responseStream.CopyToAsync(memoryStream);
663

  
664
                        defaultBitmapImage.BeginInit();
665
                        defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
666
                        defaultBitmapImage.StreamSource = memoryStream;
667
                        defaultBitmapImage.DecodePixelWidth = (int)(pageWidth * (zoomAndPanControl.ContentScale * 10));
668
                        defaultBitmapImage.DecodePixelHeight = (int)(pageHeight * (zoomAndPanControl.ContentScale * 10));
669
                        defaultBitmapImage.EndInit();
670
                        defaultBitmapImage.Freeze();
671
                    }
672
                }
673
            }
674
            //defaultBitmapImage.Dispatcher.Invoke(() => { 
675
            //    defaultBitmapImage.BeginInit();
676
            //    defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
677
            //    defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad;
678
            //    defaultBitmapImage.UriSource = uri;
679
            //    defaultBitmapImage.DecodePixelWidth = Convert.ToInt32(pageWidth);
680
            //    defaultBitmapImage.DecodePixelHeight = Convert.ToInt32(pageHeight);// * zoomAndPanControl.ContentScale
681
            //    defaultBitmapImage.EndInit();
682

  
683
            //    ViewerDataModel.Instance.ImageViewPath = null;
684
            //    Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage Downloading", 1);
685
            //    if (defaultBitmapImage.IsDownloading)
686
            //    {
687
            //        Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage IsDownloading", 1);
688
            //        defaultBitmapImage.DownloadCompleted += (ex, arg) =>
689
            //        {
690
            //            defaultBitmapImage.Freeze();
691
            //            ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage;
692
            //            ViewerDataModel.Instance.ImageViewWidth = pageWidth;
693
            //            ViewerDataModel.Instance.ImageViewHeight = pageHeight;
694

  
695
            //            //image dispose
696
            //            defaultBitmapImage = null;
697

  
698
            //            GC.Collect();
699
            //        };
700
            //    }
701
            //});
702

  
703
            System.Diagnostics.Debug.WriteLine("이미지 다운로드");
704
            return defaultBitmapImage;
676 705
        }
677 706

  
678 707
        /// <summary>
......
3623 3652
                            {
3624 3653
                                //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint))
3625 3654
                                //{
3626
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO);
3655
                                    var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO,App.isExternal);
3627 3656

  
3628 3657
                                    if (_sign == null)
3629 3658
                                    {
......
5242 5271
            e.Effects = DragDropEffects.None;
5243 5272
        }
5244 5273

  
5274
        private async void ZoomAndPanControl_ScaleChanged(object sender, RoutedEventArgs e)
5275
        {
5276
            var pageWidth = ViewerDataModel.Instance.ImageViewWidth;
5277
            var pageHeight = ViewerDataModel.Instance.ImageViewHeight;
5278
            var pageUri = pageNavigator.CurrentPage.PageUri;
5279
            var contentScale = zoomAndPanControl.ContentScale;
5280

  
5281
            ViewerDataModel.Instance.ImageViewPath = await ImageSourceHelper.GetDownloadImageAsync(pageUri, pageWidth * contentScale, pageHeight * contentScale);
5282
        }
5283

  
5245 5284
        private void thumbnailPanel_SizeChanged(object sender, SizeChangedEventArgs e)
5246 5285
        {
5247 5286
            CommonLib.Common.WriteConfigString("SetThumbnail", "WIDTH", thumbnailPanel.Width.ToString());
5248 5287
        }
5249 5288

  
5289

  
5250 5290
        /*
5251 5291
        private void zoomAndPanControl_Drop(object sender, DragEventArgs e)
5252 5292
        {

내보내기 Unified diff

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