Skip to content

How to call a command from outside its class in VS Community Toolkit #520

Discussion options

You must be logged in to vote

When you call RegisterCommandsAsync() at the package level, this method uses reflection to find all subclasses of BaseCommand and create and initialize the commands by calling InitializeAsync(). You can add any code that you want in this method, including code to store a reference to the singleton. Later in BeforeQueryStatus() and Execute() you are free to do whatever you want.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pbanosdev
Comment options

Answer selected by pbanosdev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants