-
Notifications
You must be signed in to change notification settings - Fork 635
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
Public event for view extensions to indicate a close action on the extensions sidebar. #11242
Conversation
@reddyashish Looks clean and do you think it would be possible to add a unit test for that in one of the view extension tests? |
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.
Agree we should have a test.
Also, I think there is a design issue with this approach. As an extension author I wouldn't want to get ViewExtensionClosed events for extensions that are not my own. Can we come up with a design that triggers the event to the right extension instead?
to @mmisol's point - perhpas a hook rather than event makes more sense - for example, the |
@mjkkirschner I agree that would be the cleanest approach. However I don't think we can change |
@mmisol we can add a new interface and merge them together at 3.x
we would need to document this of course. |
@mjkkirschner While that would work, I think it might be better to have a base class, kinda like we have with the start configuration for
And whenever we are on .NET core just use this :) https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/default-interface-methods-versions |
@mmisol - yes I am so ready for default implementations. hmm, just for some thoughts I think the interface pattern is actually less risky for API breaks because we can't accidentally change any implementation details out from under devs by making some change to the base class. I guess we could be strict and enforce that all members are abstract for this base class? |
@mjkkirschner It could be abstract but its members can't be, otherwise we would be in the same circumstances. It should have dummy/empty implementations, i.e. the defaults. Here is a link to the example base class I was talking about: Here is a link to how we use it in the constructor of |
Closed this as I had to pull in latest changes from master and opened a new PR: #11260 to address the task. |
Purpose
This PR is for the task: https://jira.autodesk.com/browse/DYN-3214
@saintentropy requested an improvement to have a public event that would be raised when the view extension is closed from the right hand side bar. In the current environment, we have a static internal event CloseExtension on the DynamoView that would be raised when the view extension is closed. But a public event on the ViewLoadedParams would be useful to directly perform some action on the ViewExtension when it is closed. This public event ViewExtensionClosed is similar to the CloseExtension event on DynamoView.
The other option would be to convert the internal CloseExtension event into public and let the users use it. But Craig mentioned that it would be easy to find and use if it is on the ViewLoadedParams.
Let me know what the team thinks about both these options and will creating an extra event on the ViewLoadedParams cause any downsides?
Declarations
Check these if you believe they are true
*.resx
filesReviewers
@QilongTang @mmisol @mjkkirschner @aparajit-pratap
.