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(); } }
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(); } }
public void Unload() { this.scrollViewer.Visibility = System.Windows.Visibility.Collapsed; this.scrollViewer.ScrollToHorizontalOffset(0); this.scrollViewer.ScrollToVerticalOffset(0); this.CurrentPageIndex = 0; this.imageProvider = null; }
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; }