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

Redundant code #12

Open
tonyhallett opened this issue Oct 14, 2023 · 0 comments
Open

Redundant code #12

tonyhallett opened this issue Oct 14, 2023 · 0 comments

Comments

@tonyhallett
Copy link

protected async Task ExecuteAsync(OleMenuCmdEventArgs e)

        protected async Task ExecuteAsync(OleMenuCmdEventArgs e)
        {
            using var scope = this._serviceProvider.CreateScope();
            BaseDICommand instance = (BaseDICommand)scope.ServiceProvider.GetRequiredService(typeof(T));
            Task executeAsyncTask = (Task)_executeAsyncMethod.Invoke(instance, new object[] { e });
            await executeAsyncTask;
        }

The OleMenuCommand will Invoke the CommandWapper Execute method. This will invoke the BaseCommand Execute which will invoke the BaseCommand ExecuteAsync if not overridden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant