@@ -50,11 +50,11 @@ public class ChromiumWebBrowser : ContentControl, IRenderWebBrowser, IWpfWebBrow
5050 public IDownloadHandler DownloadHandler { get ; set ; }
5151 public ILifeSpanHandler LifeSpanHandler { get ; set ; }
5252
53- public event ConsoleMessageEventHandler ConsoleMessage ;
54- public event StatusMessageEventHandler StatusMessage ;
55- public event FrameLoadStartEventHandler FrameLoadStart ;
56- public event FrameLoadEndEventHandler FrameLoadEnd ;
57- public event LoadErrorEventHandler LoadError ;
53+ public event EventHandler < ConsoleMessageEventArgs > ConsoleMessage ;
54+ public event EventHandler < StatusMessageEventArgs > StatusMessage ;
55+ public event EventHandler < FrameLoadStartEventArgs > FrameLoadStart ;
56+ public event EventHandler < FrameLoadEndEventArgs > FrameLoadEnd ;
57+ public event EventHandler < LoadErrorEventArgs > LoadError ;
5858
5959 public ICommand BackCommand { get ; private set ; }
6060 public ICommand ForwardCommand { get ; private set ; }
@@ -72,7 +72,6 @@ public class ChromiumWebBrowser : ContentControl, IRenderWebBrowser, IWpfWebBrow
7272 public bool CanGoBack
7373 {
7474 get { return ( bool ) GetValue ( CanGoBackProperty ) ; }
75- private set { SetValue ( CanGoBackProperty , value ) ; }
7675 }
7776
7877 public static DependencyProperty CanGoBackProperty = DependencyProperty . Register ( "CanGoBack" , typeof ( bool ) , typeof ( ChromiumWebBrowser ) ) ;
@@ -84,7 +83,6 @@ public bool CanGoBack
8483 public bool CanGoForward
8584 {
8685 get { return ( bool ) GetValue ( CanGoForwardProperty ) ; }
87- private set { SetValue ( CanGoForwardProperty , value ) ; }
8886 }
8987
9088 public static DependencyProperty CanGoForwardProperty = DependencyProperty . Register ( "CanGoForward" , typeof ( bool ) , typeof ( ChromiumWebBrowser ) ) ;
@@ -96,7 +94,6 @@ public bool CanGoForward
9694 public bool CanReload
9795 {
9896 get { return ( bool ) GetValue ( CanReloadProperty ) ; }
99- private set { SetValue ( CanReloadProperty , value ) ; }
10097 }
10198
10299 public static DependencyProperty CanReloadProperty = DependencyProperty . Register ( "CanReload" , typeof ( bool ) , typeof ( ChromiumWebBrowser ) ) ;
@@ -165,7 +162,7 @@ protected virtual void OnAddressChanged(string oldValue, string newValue)
165162 Dispatcher
166163 ) ;
167164
168- managedCefBrowserAdapter . LoadUrl ( Address ) ;
165+ managedCefBrowserAdapter . LoadUrl ( newValue ) ;
169166 }
170167
171168 #endregion Address dependency property
@@ -175,7 +172,6 @@ protected virtual void OnAddressChanged(string oldValue, string newValue)
175172 public bool IsLoading
176173 {
177174 get { return ( bool ) GetValue ( IsLoadingProperty ) ; }
178- set { SetValue ( IsLoadingProperty , value ) ; }
179175 }
180176
181177 public static readonly DependencyProperty IsLoadingProperty =
@@ -188,19 +184,18 @@ public bool IsLoading
188184 public bool IsBrowserInitialized
189185 {
190186 get { return ( bool ) GetValue ( IsBrowserInitializedProperty ) ; }
191- set { SetValue ( IsBrowserInitializedProperty , value ) ; }
192187 }
193188
194189 public static readonly DependencyProperty IsBrowserInitializedProperty =
195- DependencyProperty . Register ( "IsBrowserInitialized" , typeof ( bool ) , typeof ( ChromiumWebBrowser ) , new PropertyMetadata ( false , OnIsBrowserInitializedChanged ) ) ;
190+ DependencyProperty . Register ( "IsBrowserInitialized" , typeof ( bool ) , typeof ( ChromiumWebBrowser ) , new PropertyMetadata ( false , OnIsBrowserInitializedChanged ) ) ;
196191
197192 public event DependencyPropertyChangedEventHandler IsBrowserInitializedChanged ;
198193
199194 private static void OnIsBrowserInitializedChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
200195 {
201196 var owner = ( ChromiumWebBrowser ) d ;
202- bool oldValue = ( bool ) e . OldValue ;
203- bool newValue = ( bool ) e . NewValue ;
197+ var oldValue = ( bool ) e . OldValue ;
198+ var newValue = ( bool ) e . NewValue ;
204199
205200 owner . OnIsBrowserInitializedChanged ( oldValue , newValue ) ;
206201
@@ -339,6 +334,14 @@ public void Dispose()
339334
340335 protected virtual void Dispose ( bool isdisposing )
341336 {
337+ Loaded -= OnLoaded ;
338+ Unloaded -= OnUnloaded ;
339+
340+ GotKeyboardFocus -= OnGotKeyboardFocus ;
341+ LostKeyboardFocus -= OnLostKeyboardFocus ;
342+
343+ IsVisibleChanged -= OnIsVisibleChanged ;
344+
342345 Cef . RemoveDisposable ( this ) ;
343346
344347 RemoveSourceHook ( ) ;
@@ -364,7 +367,6 @@ protected virtual void Dispose(bool isdisposing)
364367 public string TooltipText
365368 {
366369 get { return ( string ) GetValue ( TooltipTextProperty ) ; }
367- set { SetValue ( TooltipTextProperty , value ) ; }
368370 }
369371
370372 public static readonly DependencyProperty TooltipTextProperty =
@@ -658,9 +660,9 @@ void IWebBrowserInternal.SetNavState(bool canGoBack, bool canGoForward, bool can
658660 {
659661 UiThreadRunAsync ( ( ) =>
660662 {
661- CanGoBack = canGoBack ;
662- CanGoForward = canGoForward ;
663- CanReload = canReload ;
663+ SetCurrentValue ( CanGoBackProperty , canGoBack ) ;
664+ SetCurrentValue ( CanGoForwardProperty , canGoForward ) ;
665+ SetCurrentValue ( CanReloadProperty , canReload ) ;
664666
665667 RaiseCommandsCanExecuteChanged ( ) ;
666668 } ) ;
@@ -993,12 +995,12 @@ public void Stop()
993995 managedCefBrowserAdapter . Stop ( ) ;
994996 }
995997
996- private void Back ( )
998+ public void Back ( )
997999 {
9981000 managedCefBrowserAdapter . GoBack ( ) ;
9991001 }
10001002
1001- private void Forward ( )
1003+ public void Forward ( )
10021004 {
10031005 managedCefBrowserAdapter . GoForward ( ) ;
10041006 }
@@ -1013,7 +1015,7 @@ public void Reload(bool ignoreCache)
10131015 managedCefBrowserAdapter . Reload ( ignoreCache ) ;
10141016 }
10151017
1016- private void Print ( )
1018+ public void Print ( )
10171019 {
10181020 managedCefBrowserAdapter . Print ( ) ;
10191021 }
0 commit comments