-
Notifications
You must be signed in to change notification settings - Fork 85
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
Remove ShowsUIOnMainThread, refactor UI coordination #609
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WIP, but anything related to this will go into the UI lib(s) Co-Authored-By: kenjiuno <[email protected]>
...this kind of resets things almost back to how they were before with the _syncContext. So...do we roll back to not using the UIFactory? Ugh....need to think this through more.
"Main Thread" is the thread the SparkleUpdater was started on
Allows you to close main window and other forms for NetSparkleUpdater keep going.
Don't need it. NetSparkleUpdater assumes main thread use now, which most users will be doing anyway.
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This param just doesn't belong in the core lib and should be entirely handled at the UI lib level if it exists at all. Furthermore, Avalonia never supported it, and WPF users probably didn't want it, and it was broken in some cases for WinForms, so it was not good to even have it available for those UI libraries.
Refactors UI stuff for easier code maintenance, better separation of concerns, etc.
NOTE: This is definitely a WIP and depending on how this goes I might close this PR and start over. May need to do bigger refactoring than initially expected to make this fully work, perhaps even making the UIs fully rely on events rather than direct callbacks or something. Hm hm hmm....getting rid of thenew Thread
for the progress/update/etc windows is cleaner code, but then on WinForms if the main form is closed, the other forms are closed, which is behavior we don't want (we want user to be able to update the software w/o the main form open). Logically this should be handled in the UI side of the lib.Basically we have a catch-22 right now: If we keep the UI interfaces the way they are, and the core lib can talk directly to UI objects, we need to keep the sync context around and/or marshal everything through the UI funcs so we make sure to talk to the UI on the right thread. But then events and things are gross, as an event being triggered really shouldn't be dependent on thread, yet that's how the code is set up now.If we made the UI just use events, and essentially the UI and core lib talk back and forth that way, the UI libs would be more repetitive code between them, but it makes the core lib a lot cleaner.Hm hm hmm...need to think through more. Might close this PR and restart, not sure.Design goals:
Currently attempting this by making the default behavior just be posting to_syncContext.Post
. This works in our samples. If user makes their UIFactory implementIUIThreadManager
, then they can handle this themselves.To do/try:
What we did: Instead of making
SparkleUpdater
super gross by handling whatever sort of threading the user wants to throw at us, we simplified by forcing end users to do complex cases themselves via events. They can even use the built in UI objects, but they can't use the UIFactory stuff with multiple threads -- it just won't work, andSparkleUpdater
isn't meant to handle it. If they want to show the UI on threads that aren't the main thread OR (on winforms) make it so the main form can be closed by other update forms stick around, they'll need to follow theNetSparkle.Samples.Forms.Multithread
sample and use events to handle showing/hiding the UI themselves.May want to revisit the "UIs are handled by events" after this change as that might not be to bad to pull off at this point...and would simplify the core lib more...not sure on that one.
Closes:
Closes #470
Closes #469
Closes #397
Closes #349