Skip to content

Commit 21e9dfa

Browse files
committed
Merge pull request #471 from amaitland/fix/wpf-loadurl
Fix/Implement WPF Load(url) Method
2 parents 12f9c29 + 88072a4 commit 21e9dfa

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

CefSharp.WinForms/ChromiumWebBrowser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class ChromiumWebBrowser : Control, IWebBrowserInternal, IWinFormsWebBrow
1919
public string Title { get; set; }
2020
public bool IsLoading { get; private set; }
2121
public string TooltipText { get; private set; }
22-
public string Address { get; set; }
22+
public string Address { get; private set; }
2323

2424
public IDialogHandler DialogHandler { get; set; }
2525
public IJsDialogHandler JsDialogHandler { get; set; }

CefSharp.Wpf/ChromiumWebBrowser.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -148,21 +148,7 @@ protected virtual void OnAddressChanged(string oldValue, string newValue)
148148
return;
149149
}
150150

151-
if (!Cef.IsInitialized &&
152-
!Cef.Initialize())
153-
{
154-
throw new InvalidOperationException("Cef::Initialize() failed");
155-
}
156-
157-
// TODO: Consider making the delay here configurable.
158-
tooltipTimer = new DispatcherTimer(
159-
TimeSpan.FromSeconds(0.5),
160-
DispatcherPriority.Render,
161-
OnTooltipTimerTick,
162-
Dispatcher
163-
);
164-
165-
managedCefBrowserAdapter.LoadUrl(newValue);
151+
Load(newValue);
166152
}
167153

168154
#endregion Address dependency property
@@ -944,7 +930,21 @@ void IWebBrowserInternal.OnInitialized()
944930

945931
public void Load(string url)
946932
{
947-
throw new NotImplementedException();
933+
if (!Cef.IsInitialized &&
934+
!Cef.Initialize())
935+
{
936+
throw new InvalidOperationException("Cef::Initialize() failed");
937+
}
938+
939+
// TODO: Consider making the delay here configurable.
940+
tooltipTimer = new DispatcherTimer(
941+
TimeSpan.FromSeconds(0.5),
942+
DispatcherPriority.Render,
943+
OnTooltipTimerTick,
944+
Dispatcher
945+
);
946+
947+
managedCefBrowserAdapter.LoadUrl(url);
948948
}
949949

950950
public void LoadHtml(string html, string url)

CefSharp/IWebBrowser.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,12 @@ public interface IWebBrowser : IDisposable
139139
bool CanReload { get; }
140140

141141
/// <summary>
142-
/// The address (URL) which the browser control is currently displaying. Can be set to a simplified URL
143-
/// (e.g. www.google.com) or a full URL (e.g. http://www.google.com). Will automatically be updated as the user
144-
/// navigates to another page (e.g. by clicking on a link).
142+
/// The address (URL) which the browser control is currently displaying.
143+
/// Will automatically be updated as the user navigates to another page (e.g. by clicking on a link).
145144
/// </summary>
146145
/// <remarks>In the WPF control, this property is implemented as a Dependency Property and fully supports data
147146
/// binding.</remarks>
148-
string Address { get; set; }
147+
string Address { get; }
149148

150149
/// <summary>
151150
/// The title of the web page being currently displayed.

0 commit comments

Comments
 (0)