Skip to content

Commit

Permalink
WinForms/WPF/OffScreen - Add LoadUrl method (Same as Load(string)).
Browse files Browse the repository at this point in the history
A more meaningful name for the method, matches the LoadUrlAsync method
that was added recently.
  • Loading branch information
amaitland committed Oct 8, 2021
1 parent 7722881 commit c226d34
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
5 changes: 1 addition & 4 deletions CefSharp.OffScreen/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,7 @@ public Task<Bitmap> ScreenshotAsync(bool ignoreExistingScreenshot = false, Popup
return completionSource.Task;
}

/// <summary>
/// Loads the specified URL.
/// </summary>
/// <param name="url">The URL to be loaded.</param>
/// <inheritdoc/>
public void Load(string url)
{
Address = url;
Expand Down
5 changes: 1 addition & 4 deletions CefSharp.WinForms/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,7 @@ private void InternalDispose(bool disposing)
Cef.RemoveDisposable(this);
}

/// <summary>
/// Loads the specified URL.
/// </summary>
/// <param name="url">The URL to be loaded.</param>
/// <inheritdoc/>
public void Load(string url)
{
if (IsBrowserInitialized)
Expand Down
5 changes: 1 addition & 4 deletions CefSharp.Wpf/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2414,10 +2414,7 @@ protected override AutomationPeer OnCreateAutomationPeer()

}

/// <summary>
/// Loads the specified URL.
/// </summary>
/// <param name="url">The URL to be loaded.</param>
/// <inheritdoc/>
public void Load(string url)
{
if (!InternalIsBrowserInitialized())
Expand Down
15 changes: 14 additions & 1 deletion CefSharp/IWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,24 @@ public interface IWebBrowser : IDisposable
event EventHandler<JavascriptMessageReceivedEventArgs> JavascriptMessageReceived;

/// <summary>
/// Loads the specified <paramref name="url"/> in the Main Frame
/// Loads the specified <paramref name="url"/> in the Main Frame.
/// Same as calling <see cref="LoadUrl(string)"/>
/// </summary>
/// <param name="url">The URL to be loaded.</param>
void Load(string url);

/// <summary>
/// Loads the specified <paramref name="url"/> in the Main Frame.
/// Same as calling <see cref="Load(string)"/>
/// </summary>
/// <param name="url">The URL to be loaded.</param>
/// <remarks>
/// This is exactly the same as calling Load(string), it was added
/// as the method name is more meaningful and easier to discover
/// via Intellisense.
/// </remarks>
void LoadUrl(string url);

/// <summary>
/// Load the <paramref name="url"/> in the main frame of the browser
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions CefSharp/Internals/Partial/ChromiumWebBrowser.Partial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ void IWebBrowserInternal.OnAfterBrowserCreated(IBrowser browser)
OnAfterBrowserCreated(browser);
}

/// <inheritdoc/>
public void LoadUrl(string url)
{
Load(url);
}

/// <inheritdoc/>
public Task<LoadUrlAsyncResponse> LoadUrlAsync(string url = null, SynchronizationContext ctx = null)
{
Expand Down

0 comments on commit c226d34

Please sign in to comment.