Skip to content

Commit 23fac32

Browse files
committed
Updated readme
1 parent 935de8a commit 23fac32

File tree

1 file changed

+60
-31
lines changed

1 file changed

+60
-31
lines changed

README.md

Lines changed: 60 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,57 @@
22

33
[![donate](https://img.shields.io/badge/Donate-Donorbox-green.svg)](https://donorbox.org/electron-net) [![Gitter](https://badges.gitter.im/ElectronNET/community.svg)](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml/badge.svg)](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml)
44

5-
# Electron.Net Core is here!
5+
# Electron.NET Core is here!
66

77
## A Complete Transformation
88

9-
ElectronNET.Core represents a fundamental modernization of Electron.NET, addressing years of accumulated pain points while preserving full API compatibility. This isn't just an updateit's a complete rethinking of how .NET developers build and debug cross-platform desktop applications with Electron.
9+
`ElectronNET.Core` represents a fundamental modernization of Electron.NET, addressing years of accumulated pain points while preserving full API compatibility. This isn't just an updateit's a complete rethinking of how .NET developers build and debug cross-platform desktop applications with Electron.
1010

11-
Read more: [**What's New in ElectronNET.Core**](wiki/What's-New)
12-
13-
14-
Build cross platform desktop applications with .NET 6/8 - from console apps to ASP.Net Core (Razor Pages, MVC) to Blazor
11+
Read more: [**What's New in `ElectronNET.Core`**](https://github.com/ElectronNET/Electron.NET/wiki/What's-New)
1512

13+
Build cross platform desktop applications with .NET 6/8/10 - from console apps to ASP.NET Core (Razor Pages, MVC) to Blazor.
1614

1715
## Wait - how does that work exactly?
1816

19-
Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET based solutions using Electron at the side of presentation. While the classic Electron.Net setup, using an ASP.Net host ran by the Electron side is still the primary way, there's more flexibility now: both, dotnet and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server - like when running content from files or remote servers, you can drop the ASP.Net stack altogether and got with a lightweight console app instead.
17+
Well... there are lots of different approaches how to get a X-plat desktop app running. Electron.NET provides a range of ways to build .NET based solutions using Electron at the side of presentation.
2018

21-
## 📦 NuGet
19+
While the classic Electron.NET setup, using an ASP.NET host ran by the Electron side is still the primary way, there's more flexibility now: both, dotnet and Electron are now able to launch the other for better lifetime management, and when you don't need a local web server - like when running content from files or remote servers, you can drop the ASP.NET stack altogether and got with a lightweight console app instead.
2220

23-
[![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.svg?style=flat-square) ElectronNET.Core ](https://www.nuget.org/packages/ElectronNET.Core.API/) | [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.API.svg?style=flat-square) ElectronNET.Core.API ](https://www.nuget.org/packages/ElectronNET.Core.API/) | [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.AspNet.svg?style=flat-square) ElectronNET.Core.AspNet ](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
21+
## 📦 NuGet
2422

23+
* ElectronNET.Core: [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.Core.API/)
24+
* ElectronNET.Core.API: [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.API.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.Core.API/)
25+
* ElectronNET.Core.AspNet: [![NuGet](https://img.shields.io/nuget/v/ElectronNET.Core.AspNet.svg?style=flat-square)](https://www.nuget.org/packages/ElectronNET.Core.AspNet/)
2526

2627
## 🛠 Requirements to Run
2728

28-
Our API uses .NET 6/8, so our
29-
30-
Also you should have installed:
31-
32-
* .NET 6/8 or later
33-
* OS
34-
minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md) / [.NET 8](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md).
35-
* NodeJS (at least [Version 22.x](https://nodejs.org))
29+
You should have installed:
3630

31+
* .NET 6/8 or later.
32+
* The minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md) / [.NET 8](https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md).
33+
* Node.JS using at least [Version 22.x](https://nodejs.org).
3734

38-
## 👩‍🏫 Usage with ASP.Net
35+
## 👩‍🏫 Usage with ASP.NET
3936

40-
- Create a new ASP.Net Core project
41-
- Install the following two nuget packages:
37+
- Create a new ASP.NET Core project
38+
- Install the following two NuGet packages:
4239

4340
```ps1
4441
dotnet add package ElectronNET.Core
4542
4643
dotnet add package ElectronNET.Core.AspNet
4744
```
4845

49-
### Enable Electron.NET on Startup
46+
### Classic ASP.NET Core
47+
48+
#### Enable Electron.NET on Startup
5049

5150
To do so, use the `UseElectron` extension method on a `WebApplicationBuilder`, an `IWebHostBuilder` or any descendants.
5251

5352
> [!NOTE]
5453
> New in Electron.NET Core is that you provide a callback method as an argument to `UseElectron()`, which ensures that you get to know the right moment to set up your application UI.
5554
56-
### Program.cs
55+
#### Program.cs
5756

5857
```csharp
5958
using ElectronNET.API;
@@ -68,7 +67,7 @@ using ElectronNET.API.Entities;
6867
.Run();
6968
}
7069

71-
public static async Task ElectronAppReady()
70+
public static async Task ElectronAppReady()
7271
{
7372
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
7473
new BrowserWindowOptions { Show = false });
@@ -77,11 +76,46 @@ using ElectronNET.API.Entities;
7776
}
7877
```
7978

79+
### Minimal API Example
8080

81-
## 🚀 Starting and Debugging the Application
81+
For a minimal API you can use:
82+
83+
```csharp
84+
using ElectronNET;
85+
using ElectronNET.API;
86+
using ElectronNET.API.Entities;
87+
88+
var builder = WebApplication.CreateBuilder(args);
8289

83-
Just press F5 in Visual Studio or use dotnet for debugging.
90+
builder.Services.AddRazorPages();
91+
builder.Services.AddElectron(); // <- might be useful to set up DI
8492
93+
builder.UseElectron(args, async () =>
94+
{
95+
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
96+
new BrowserWindowOptions { Show = false, AutoHideMenuBar = true });
97+
98+
browserWindow.OnReadyToShow += () => browserWindow.Show();
99+
});
100+
101+
var app = builder.Build();
102+
103+
// Configure the HTTP request pipeline.
104+
if (!app.Environment.IsDevelopment())
105+
{
106+
app.UseExceptionHandler("/Error");
107+
}
108+
109+
app.UseStaticFiles();
110+
app.UseRouting();
111+
app.UseAuthorization();
112+
app.MapRazorPages();
113+
app.Run();
114+
```
115+
116+
## 🚀 Starting and Debugging the Application
117+
118+
Just press `F5` in Visual Studio or use dotnet for debugging.
85119

86120
## 📔 Usage of the Electron API
87121

@@ -92,13 +126,11 @@ In this YouTube video, we show you how you can create a new project, use the Ele
92126
> [!NOTE]
93127
> The video hasn't been updated for the changes in ElectronNET.Core, so it is partially outdated.
94128
95-
96-
97129
## 👨‍💻 Authors
98130

99131
* **[Gregor Biswanger](https://github.com/GregorBiswanger)** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
100132
* **[Dr. Florian Rappl](https://github.com/FlorianRappl)** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [The Art of Micro Frontends](https://microfrontends.art) - [Homepage](https://florian-rappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
101-
* [**softworkz**](https://github.com/softworkz) - full range developer - likes to start where others gave up - MS MVP alumni and Munich citizen as well
133+
* **[softworkz](https://github.com/softworkz)** - Full Range Developer - likes to start where others gave up. MS MVP alumni and Munich citizen as well.
102134
* **[Robert Muehsig](https://github.com/robertmuehsig)** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
103135

104136
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
@@ -108,7 +140,6 @@ See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/
108140
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
109141
Please make sure all commits are properly documented.
110142

111-
112143
## 🙏 Donate
113144

114145
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
@@ -127,6 +158,4 @@ Any support appreciated! 🍻
127158
MIT-licensed. See [LICENSE](./LICENSE) for details.
128159

129160
**Enjoy!**
130-
131-
132161

0 commit comments

Comments
 (0)