mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 19:25:01 +00:00
48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
|
|
namespace CefSharp.Example
|
|
{
|
|
public static class CefExample
|
|
{
|
|
public const string DefaultUrl = "custom://cefsharp/BindingTest.html";
|
|
|
|
// Use when debugging the actual SubProcess, to make breakpoints etc. inside that project work.
|
|
private static readonly bool DebuggingSubProcess = Debugger.IsAttached;
|
|
|
|
public static void Init()
|
|
{
|
|
var settings = new CefSettings();
|
|
settings.RemoteDebuggingPort = 8088;
|
|
//settings.CefCommandLineArgs.Add("renderer-process-limit", "1");
|
|
//settings.CefCommandLineArgs.Add("renderer-startup-dialog", "renderer-startup-dialog");
|
|
settings.LogSeverity = LogSeverity.Verbose;
|
|
|
|
if (DebuggingSubProcess)
|
|
{
|
|
var architecture = Environment.Is64BitProcess ? "x64" : "x86";
|
|
settings.BrowserSubprocessPath = "..\\..\\..\\..\\CefSharp.BrowserSubprocess\\bin\\" + architecture + "\\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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|