コード例 #1
0
 private void ShowWaitScreen()
 {
     if (FullScreenPrintWindow != null)
     {
         WaitScreen.Show("Loading...");
     }
 }
コード例 #2
0
        public void ReloadPreview(PageOrientation pageOrientation, PaperSize currentPaper)
        {
            ReloadingPreview = true;
            if (FullScreenPrintWindow != null)
            {
                WaitScreen.Show("Loading Preview");
            }

            if (PageOrientation == PageOrientation.Portrait)
            {
                FlowDocument.PageHeight = currentPaper.Height;
                FlowDocument.PageWidth  = currentPaper.Width;
            }
            else
            {
                FlowDocument.PageHeight = currentPaper.Width;
                FlowDocument.PageWidth  = currentPaper.Height;
            }

            _ms  = new MemoryStream();
            _pkg = Package.Open(_ms, FileMode.Create, FileAccess.ReadWrite);
            const string pack       = "pack://temp.xps";
            var          oldPackage = PackageStore.GetPackage(new Uri(pack));

            if (oldPackage == null)
            {
                PackageStore.AddPackage(new Uri(pack), _pkg);
            }
            else
            {
                PackageStore.RemovePackage(new Uri(pack));
                PackageStore.AddPackage(new Uri(pack), _pkg);
            }
            _xpsDocument = new XpsDocument(_pkg, CompressionOption.SuperFast, pack);
            var xpsWriter = XpsDocument.CreateXpsDocumentWriter(_xpsDocument);

            var documentPaginator = ((IDocumentPaginatorSource)FlowDocument).DocumentPaginator;

            xpsWriter.Write(documentPaginator);
            Paginator   = documentPaginator;
            MaxCopies   = NumberOfPages = ApproaxNumberOfPages = Paginator.PageCount;
            PagesAcross = 2;
            DisplayPagePreviewsAll(documentPaginator);
            WaitScreen.Hide();
            ReloadingPreview = false;
        }