mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
[PR #905] [MERGED] Initial refactoring of dotnet API #1344
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ElectronNET/Electron.NET/pull/905
Author: @agracio
Created: 11/5/2025
Status: ✅ Merged
Merged: 11/6/2025
Merged by: @FlorianRappl
Base:
develop← Head:develop📝 Commits (6)
689a002refactoring dotnet events408f83erefactoring dotnet eventsb6b9292refactoring dotnet eventsea68802refactoring dotnet events87668f5removing '-event' suffix from event names to normalise naming conventionde7f981removing '-event' suffix from event names to normalise naming convention📊 Changes
23 files changed (+306 additions, -1452 deletions)
View changed files
📝
src/ElectronNET.API/API/App.cs(+21 -145)📝
src/ElectronNET.API/API/AutoUpdater.cs(+14 -120)📝
src/ElectronNET.API/API/BrowserWindow.cs(+56 -594)📝
src/ElectronNET.API/API/NativeTheme.cs(+3 -22)📝
src/ElectronNET.API/API/PowerMonitor.cs(+17 -142)📝
src/ElectronNET.API/API/Screen.cs(+7 -63)📝
src/ElectronNET.API/API/Tray.cs(+14 -129)📝
src/ElectronNET.API/API/WebContents.cs(+20 -182)📝
src/ElectronNET.API/API/WindowManager.cs(+1 -1)➕
src/ElectronNET.API/Common/ApiEventManager.cs(+99 -0)📝
src/ElectronNET.Host/api/app.js(+9 -9)📝
src/ElectronNET.Host/api/app.ts(+9 -9)📝
src/ElectronNET.Host/api/autoUpdater.js(+6 -6)📝
src/ElectronNET.Host/api/autoUpdater.ts(+6 -6)📝
src/ElectronNET.Host/api/nativeTheme.js(+1 -1)📝
src/ElectronNET.Host/api/nativeTheme.ts(+1 -1)📝
src/ElectronNET.Host/api/screen.js(+3 -3)📝
src/ElectronNET.Host/api/screen.js.map(+1 -1)📝
src/ElectronNET.Host/api/screen.ts(+3 -3)📝
src/ElectronNET.Host/api/tray.js(+6 -6)...and 3 more files
📄 Description
Currently events and tasks have a lot of repetitive code, this RP attempts to remove some of the repetition starting with events.
Changes summary
ApiEventManagerto wrap events code.App.cs,BrowserWindow.cs,Tray.cs,AutoUpdater.cs,NativeTheme.cs,PowerMonitor.cs,Screen.cs,WebContents.csTrayandScreenAPI.Different event naming and Tray API changes
Currently Electron.NET API has multiple event naming schemes making it harder to implement a single method for wrapping events, examples below. Event names in .NET API correspond to event names in TypeScript/JS implementation.
BrowserWindowAPI does not add any additional names to events.AppAPI adds-eventtoEmit()method.TrayandScreenAPI was adding-eventtoOn()method.In order to keep different method signatures to a minimum I have renamed Tray and Screen API events in line with BrowserWindow.
This is a work in progress but would like to get some feedback to make sure the change is acceptable.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.