Cancel VS2010 project creation from wizard

十年热恋 提交于 2020-01-13 10:38:51

问题


I created a wizard for a custom template in VS2010 And it works like a charm.

But since the wizard contains a form required to finish the creation of the project, i feel that the user should be able to cancel the creation of the project.

So my question being..

Is it possible to cancel the creation of a project/template process from inside a wizard implementing IWizard?

These are the events i got at my disposal.

public void BeforeOpeningFile(ProjectItem projectItem)

public void ProjectFinishedGenerating(Project project)

public void ProjectItemFinishedGenerating(ProjectItem projectItem)

public void RunFinished()

public void RunStarted(object automationObject,
        Dictionary<string, string> replacementsDictionary,
        WizardRunKind runKind, object[] customParams)

public bool ShouldAddProjectItem(string filePath)

Thank you!


回答1:


Yes. To indicate that the user has cancelled the wizard, just throw a new WizardCancelledException in your IWizard implementation.

A very interesting article which explains all this: Pitfalls of cancelling a VSIX project template in an IWizard



来源:https://stackoverflow.com/questions/3586502/cancel-vs2010-project-creation-from-wizard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!