mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 12:09:40 +00:00
Create CefExample class to house common Init() and DefaultUrl
Conflicts: CefSharp.WinForms.Example/BrowserForm.cs
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace CefSharp.Example
|
||||
{
|
||||
public static class CefExample
|
||||
{
|
||||
public const string DefaultUrl = "custom://cefsharp/home";
|
||||
|
||||
// Use when debugging the actual SubProcess, to make breakpoints etc. inside that project work.
|
||||
private const bool debuggingSubProcess = false;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
var settings = new CefSettings();
|
||||
settings.RemoteDebuggingPort = 8088;
|
||||
|
||||
if (debuggingSubProcess)
|
||||
{
|
||||
settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\x86\\Debug\\CefSharp.BrowserSubprocess.exe";
|
||||
}
|
||||
|
||||
settings.RegisterScheme(new CefCustomScheme
|
||||
{
|
||||
SchemeName = CefSharpSchemeHandlerFactory.SchemeName,
|
||||
SchemeHandlerFactory = new CefSharpSchemeHandlerFactory()
|
||||
});
|
||||
|
||||
if (!Cef.Initialize(settings))
|
||||
{
|
||||
if (Environment.GetCommandLineArgs().Contains("--type=renderer"))
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Cef.RegisterJsObject("bound", new BoundObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user