-
-
Notifications
You must be signed in to change notification settings - Fork 736
Initial refactoring of dotnet API #905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Actually much appreciated - with more time this is something on my list (really cumbersome code in some areas, could benefit a lot from some refactoring... - so great job 🚀 !). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, definitely appreciated and goes in the right direction. Just let me know when you are done / want to see it merged in.
|
Almost done with events but would also want to clean up at least some of the tasks code. I will let you know when events are done. |
|
Events are done. Even managed to find an error in one of them. Task optimisation is next but you can merge event changes first if you want. |
|
Tasks will take significantly longer. There are many different types and of course different naming. On subject of naming - is SocketIO case sensitive, there are some tasks that end in |
|
Yeah so in general these strings are all case sensitive - personally, I'd make it consistent (I've seen that across the codebase many things in that area a bit inconsistent to write the least... - so using the opportunity to make the naming / transported names consistent would be appreciated). Many thanks for your efforts - so we'll merge this one right now and do another PR at some point in time later? @agracio |
|
Yes I would suggest to merge these changes first while I work on tasks. There is more than I initially thought. |
|
Alternatively I can refactor |
OK let's add this then merge! Thanks! |
|
All done. Please give it a thorough review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - at least I could not see anything going wrong here in the review pane. Let's merge and test with the preview version.
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.