c# - WPF WebBrowserControl: removal of PDF is slow -


i'm using webbrowser control in wpf display pdf documents.

displaying pdf assigning local uri works within few 100 milliseconds.

webbrowser.source = new uri(path); 

but assigning null remove pdf ...

webbrowser.source = null; 

... takes second.

same reassigning new uri without setting source null before.

has idea, why assigning null webbrowser.source takes longer loading , displaying pdf document?


example:

<window x:class="wpfapp1.mainwindow"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"         xmlns:local="clr-namespace:wpfapp1"         mc:ignorable="d"         title="mainwindow" height="350" width="525">     <dockpanel lastchildfill="true">         <stackpanel dockpanel.dock="top" orientation="horizontal">             <button click="button_click" >click</button>             <button click="button_click_1" >click2</button>         </stackpanel>         <webbrowser name="webbrowser" horizontalalignment="stretch" verticalalignment="stretch"/>     </dockpanel> </window>    public partial class mainwindow : window { public mainwindow() {   initializecomponent(); }  private void button_click(object sender, routedeventargs e) {   webbrowser.source = new uri(@"t:\xp_ocr_exchange\a010.pdf"); }  private void button_click_1(object sender, routedeventargs e) {   webbrowser.source = null; } } 

when click on first button, die pdf displayed immediately. when click on second button (null assignment) takes quite while until pdf vanishes browser window.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -