コード例 #1
0
        public void Load(IPdfSource source, string password = null)
        {
            this.scrollViewer  = this.ChildOfType <ScrollViewer>();
            this.imageProvider = new PdfImageProvider(source, this.parent.TotalPages,
                                                      new PageDisplaySettings(this.parent.GetPagesPerRow(), this.parent.ViewType, this.parent.HorizontalMargin, this.parent.Rotation), false, password);

            if (scrollViewer != null)
            {
                scrollViewer.RemoveHandler(UIElement.MouseWheelEvent, new MouseWheelEventHandler(this.OnScrollWheel));
                scrollViewer.AddHandler(UIElement.MouseWheelEvent, new MouseWheelEventHandler(this.OnScrollWheel), true);
            }

            this.CurrentPageIndex = 0;

            if (this.scrollViewer != null)
            {
                this.scrollViewer.Visibility = System.Windows.Visibility.Visible;
            }

            if (this.parent.ZoomType == ZoomType.Fixed)
            {
                this.SetItemsSource();
            }
            else if (this.parent.ZoomType == ZoomType.FitToHeight)
            {
                this.ZoomToHeight();
            }
            else if (this.parent.ZoomType == ZoomType.FitToWidth)
            {
                this.ZoomToWidth();
            }
        }
コード例 #2
0
        public void Load(IPdfSource source, string password = null)
        {
            this.virtualPanel = this.ChildOfType <CustomVirtualizingPanel>();
            this.scrollViewer = this.ChildOfType <ScrollViewer>();
            this.virtualPanel.PageRowBounds = this.parent.PageRowBounds.Select(f => f.SizeIncludingOffset).ToArray();
            this.imageProvider = new PdfImageProvider(source, this.parent.TotalPages,
                                                      new PageDisplaySettings(this.parent.GetPagesPerRow(), this.parent.ViewType, this.parent.HorizontalMargin, this.parent.Rotation),
                                                      password: password);

            if (scrollViewer != null)
            {
                scrollViewer.ScrollChanged += OnScrollChanged;
            }

            if (this.parent.ZoomType == ZoomType.Fixed)
            {
                this.CreateNewItemsSource();
            }
            else if (this.parent.ZoomType == ZoomType.FitToHeight)
            {
                this.ZoomToHeight();
            }
            else if (this.parent.ZoomType == ZoomType.FitToWidth)
            {
                this.ZoomToWidth();
            }

            if (this.scrollViewer != null)
            {
                this.scrollViewer.Visibility = System.Windows.Visibility.Visible;
                this.scrollViewer.ScrollToTop();
            }
        }
コード例 #3
0
        public void Unload()
        {
            this.scrollViewer.Visibility = System.Windows.Visibility.Collapsed;
            this.scrollViewer.ScrollToHorizontalOffset(0);
            this.scrollViewer.ScrollToVerticalOffset(0);
            this.CurrentPageIndex = 0;

            this.imageProvider = null;
        }
コード例 #4
0
        public void Unload()
        {
            this.scrollViewer.Visibility = System.Windows.Visibility.Collapsed;
            this.scrollViewer.ScrollToHorizontalOffset(0);
            this.scrollViewer.ScrollToVerticalOffset(0);
            this.imageProvider = null;

            if (this.virtualizingPdfPages != null)
            {
                this.virtualizingPdfPages.CleanUpAllPages();
                this.virtualizingPdfPages = null;
            }

            this.itemsControl.ItemsSource = null;
        }