I'm creating an extension for visual studio that aims to create a project based on the options the programmer wants. In this case a wizard will be created where it will choose the entity (s) you want to create, and based on this selection will create the classes.
I have already created the template (in my case empty) and its wizard for the selection of entities. The feature selection wizard that is displayed when you create the project is in the image below. The purpose is that when doing OK a project is created with the classes that it chose, for example "ConsolidationSaldos" should give rise to a class inside an "Accounting" folder
Doubt is how to create classes dynamically based on selection.
namespacePrimavera.Extensibility.Wizard{publicclassWizardImplementation:IWizard{privateModulesfrm;privatestringcustomMessage;//Thismethodiscalledbeforeopeninganyitemthat//hastheOpenInEditorattribute.publicvoidBeforeOpeningFile(ProjectItemprojectItem){}publicvoidProjectFinishedGenerating(Projectproject){}//Thismethodisonlycalledforitemtemplates,//notforprojecttemplates.publicvoidProjectItemFinishedGenerating(ProjectItemprojectItem){}//Thismethodiscalledaftertheprojectiscreated.publicvoidRunFinished(){}publicvoidRunStarted(objectautomationObject,Dictionary<string,string>replacementsDictionary,WizardRunKindrunKind,object[]customParams){try{//Displayaformtotheuser.Theformcollectstheclassescheckedfrm=newModules();frm.ShowDialog();customMessage=Modules.CustomMessage;replacementsDictionary.Add("$custommessage$",
customMessage);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
// This method is only called for item templates,
// not for project templates.
public bool ShouldAddProjectItem(string filePath)
{
return true;
}
}
}