Exemplo n.º 1
0
        private void UpdatePageView()
        {
            Page currentPage   = this.document.Page;
            int  desiredWidth  = (int)currentPage.Width * GlobalScale;
            int  desiredHeight = (int)currentPage.Height * GlobalScale;

            byte[]       image = currentPage.RenderAsBytes(desiredWidth, desiredHeight, new RenderingSettings());
            IList <Link> links = currentPage.Links;

            SetImageSourceDelegate del = this.SetImageSource;                       //gán sự kiện vào hàm delegate

            this.Dispatcher.Invoke(del, image, links, desiredWidth, desiredHeight); //thực hiện hàm
        }
 private void UpdatePageView()
 {
     if (recentLocation != 0)
     {
         document.Document.Navigator.GoToPage(recentLocation);
         recentLocation = -1;
     }
     try
     {
         Page                   currentPage   = this.document.Page;
         int                    desiredWidth  = (int)currentPage.Width * GlobalScale;
         int                    desiredHeight = (int)currentPage.Height * GlobalScale;
         byte[]                 image         = currentPage.RenderAsBytes(desiredWidth, desiredHeight, new RenderingSettings());
         IList <Link>           links         = currentPage.Links;
         SetImageSourceDelegate del           = this.SetImageSource;             //add event into delegate
         this.Dispatcher.Invoke(del, image, links, desiredWidth, desiredHeight); //execute SetImageSource
     }
     catch (Exception)
     {
     }
 }