Proton is built on top of the WebView2 control, which enables developers to embed web technologies—HTML, CSS, and JavaScript — into native applications powered by Microsoft Edge (Chromium). Proton inherited ideas from Electron, adopting its approach of using web technologies to build desktop applications.
The nuget package can be found at nuget.org/packages/Proton
Electron uses NodeJs as its backend, while Proton is built on .NET, allowing developers to leverage built-in .NET features and better target the Win32 platform.
The Proton package supports the below environments:
- net6.0-windows and later version
For quick start you can use win form template at https://github.com/XHighIntell/Proton/tree/master/src/QuickTemplate
var webView = new ProtonWebView(this) { Dock = DockStyle.Fill };
webView.AllowResizable = true;
var environment = await CoreWebView2Environment.CreateAsync(null, "chromium");
await webView.EnsureCoreWebView2Async(environment);
webView.DefaultBackgroundColor = Color.Transparent;
//WebView.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false; // Uncomment this line if you want to disable the context menus
webView.CoreWebView2.SetVirtualHostNameToFolderMapping("localhost.pro", AppDomain.CurrentDomain.BaseDirectory + "wwwroot", CoreWebView2HostResourceAccessKind.Allow);
webView.CoreWebView2.Navigate("http://localhost.pro/demo.html");
this.Controls.Add(webView);