Skip to content

Commit

Permalink
WPF - Experimental LifeSpanHandler optional LifespanHandler construct…
Browse files Browse the repository at this point in the history
…or arg

Resolves #4285
  • Loading branch information
amaitland committed Nov 14, 2022
1 parent 3866af0 commit 824ba98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 5 additions & 8 deletions CefSharp.Wpf.Example/Views/BrowserTabView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,12 @@ public BrowserTabView()
//If browser is disposed then we don't need to remove the tab
if (!ctrl.IsDisposed)
{
ctrl.Dispatcher.Invoke(() =>
{
var owner = System.Windows.Window.GetWindow(ctrl);
var owner = System.Windows.Window.GetWindow(ctrl);
if (owner != null && owner.Content == ctrl)
{
owner.Close();
}
});
if (owner != null && owner.Content == ctrl)
{
owner.Close();
}
}
}).Build();
*/
Expand Down
6 changes: 5 additions & 1 deletion CefSharp.Wpf/Experimental/LifespanHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ public class LifeSpanHandler : CefSharp.Handler.LifeSpanHandler
private Dictionary<IntPtr, ChromiumWebBrowser> chromiumWebBrowserMap = new Dictionary<IntPtr, ChromiumWebBrowser>();
private ChromiumWebBrowser pendingChromiumWebBrowser;

public LifeSpanHandler(LifeSpanHandlerCreatePopupChromiumWebBrowser chromiumWebBrowserCreatedDelegate)
/// <summary>
/// Default constructor
/// </summary>
/// <param name="chromiumWebBrowserCreatedDelegate">optional delegate to create a custom <see cref="ChromiumWebBrowser" instance./></param>
public LifeSpanHandler(LifeSpanHandlerCreatePopupChromiumWebBrowser chromiumWebBrowserCreatedDelegate = null)
{
this.chromiumWebBrowserCreatedDelegate = chromiumWebBrowserCreatedDelegate;
}
Expand Down

0 comments on commit 824ba98

Please sign in to comment.