-
Notifications
You must be signed in to change notification settings - Fork 438
/
Copy pathProgram.netcore.cs
53 lines (45 loc) · 1.86 KB
/
Program.netcore.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using CefSharp.Wpf;
using System;
using System.IO;
namespace CefSharp.MinimalExample.Wpf
{
public static class Program
{
/// <summary>
/// Application Entry Point.
/// </summary>
[STAThread]
public static int Main(string[] args)
{
//For Windows 7 and above, app.manifest entries will take precedences of this call
Cef.EnableHighDPISupport();
//We are using our current exe as the BrowserSubProcess
//Multiple instances will be spawned to handle all the
//Chromium proceses, render, gpu, network, plugin, etc.
var subProcessExe = new CefSharp.BrowserSubprocess.BrowserSubprocessExecutable();
var result = subProcessExe.Main(args);
if (result > 0)
{
return result;
}
//We use our current exe as the BrowserSubProcess
var exePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
var settings = new CefSettings()
{
//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"),
BrowserSubprocessPath = exePath
};
//Example of setting a command line argument
//Enables WebRTC
settings.CefCommandLineArgs.Add("enable-media-stream");
// For .NET Core, don't perform a dependency check, to allow publishing single-file
// executables.
Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);
var app = new App();
app.InitializeComponent();
app.Run();
return 0;
}
}
}