Create CefExample class to house common Init() and DefaultUrl

Conflicts:
	CefSharp.WinForms.Example/BrowserForm.cs
This commit is contained in:
amaitland
2014-05-29 08:10:44 +10:00
committed by Per Lundberg
parent 9e19bce707
commit ff03b13a33
8 changed files with 50 additions and 44 deletions
+44
View File
@@ -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());
}
}
}