Skip to content

Commit

Permalink
made IsBrowserInitialized a Dependency Property
Browse files Browse the repository at this point in the history
  • Loading branch information
JanEggers committed May 23, 2014
1 parent d9b2148 commit 2cfa89e
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions CefSharp.Wpf/WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class WebView : ContentControl, IRenderWebBrowser, IWpfWebBrowser
private readonly List<IDisposable> disposables = new List<IDisposable>();

public BrowserSettings BrowserSettings { get; set; }
public bool IsBrowserInitialized { get; private set; }
public IJsDialogHandler JsDialogHandler { get; set; }
public IKeyboardHandler KeyboardHandler { get; set; }
public IRequestHandler RequestHandler { get; set; }
Expand Down Expand Up @@ -149,6 +148,42 @@ public bool IsLoading

#endregion IsLoading dependency property

#region IsBrowserInitialized dependency property

public bool IsBrowserInitialized
{
get { return (bool)GetValue(IsBrowserInitializedProperty); }
set { SetValue(IsBrowserInitializedProperty, value); }
}

public static readonly DependencyProperty IsBrowserInitializedProperty =
DependencyProperty.Register("IsBrowserInitialized", typeof(bool), typeof(WebView), new PropertyMetadata(false, OnIsBrowserInitializedChanged ));

public event DependencyPropertyChangedEventHandler IsBrowserInitializedChanged;

private static void OnIsBrowserInitializedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
WebView owner = (WebView)d;
bool oldValue = (bool)e.OldValue;
bool newValue = (bool)e.NewValue;

owner.OnIsBrowserInitializedChanged(oldValue, newValue);

var handlers = owner.IsBrowserInitializedChanged;

if (handlers != null)
{
handlers(owner, e);
}
}

protected virtual void OnIsBrowserInitializedChanged(bool oldValue, bool newValue)
{

}

#endregion IsInitialized dependency property

#region Title dependency property

public string Title
Expand Down Expand Up @@ -884,7 +919,10 @@ private void OnMouseButton(MouseButtonEventArgs e)

void IWebBrowserInternal.OnInitialized()
{
//browserCore.OnInitialized();
DoInUi(() =>
{
SetCurrentValue(IsBrowserInitializedProperty, true);
});
}

public void Load(string url)
Expand Down

0 comments on commit 2cfa89e

Please sign in to comment.