Skip to content
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

Method to get all commands from the ICommandStore #19

Open
JeremyEspresso opened this issue Jun 10, 2021 · 1 comment
Open

Method to get all commands from the ICommandStore #19

JeremyEspresso opened this issue Jun 10, 2021 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@JeremyEspresso
Copy link
Contributor

JeremyEspresso commented Jun 10, 2021

It would be nice to have a method that returns all commands in the command store.

Currently I am using the reflection way as per the samples to retrieve all commands:

var commandCount = ((List<ICommand>)_commandStore.GetType()
.GetField("_currentCommands",
BindingFlags.NonPublic | BindingFlags.Instance)!
.GetValue(_commandStore)!)

@FiniteReality
Copy link
Owner

There are multiple ways I could do this:

  • Add an optional ICommandStoreWithCount interface which exposes a RegisteredCommandCount property
  • DIM a TryGetRegisteredCommandCount method

I'm not entirely sure all command stores would be able to provide a count, which is why I'm thinking of implementing it this way. However, it's entirely possible that I'm wrong and I could just take the breaking change.

@FiniteReality FiniteReality added the enhancement New feature or request label Jun 12, 2021
@FiniteReality FiniteReality added this to the 0.3 milestone Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants