Files
cefsharp/CefSharp.Example/CefExample.cs
T
amaitland ff03b13a33 Create CefExample class to house common Init() and DefaultUrl
Conflicts:
	CefSharp.WinForms.Example/BrowserForm.cs
2014-06-12 01:49:37 +03:00

45 lines
1.3 KiB
C#

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());
}
}
}