public WizardData GetWizardData() { WizardData wz = new WizardData(); wz.Type = ucType1.GetData(); wz.SubmodulesAr = ucSubmodules1.GetData(); wz.Author = ucAuthorBlock1.GetData(); return(wz); }
// Execute is the main entry point for a project wizard. It has to follow this template. // contextParams: // 0: some GUID // 1: Project Name // 2: Project Path // 3: location of visual studio exe // 4: Create New Solution : true..... Add to existing solution: false // 5: Solution Name--- Will be empty string if not selected to create solution // 6: false // 7: "4.0" public void Execute(object Application, int hwndOwner, ref object[] contextParams, ref object[] customParams, ref EnvDTE.wizardResult retval) { try { fMain f = new fMain((string)contextParams[1]); if (f.ShowDialog() == DialogResult.OK) { // Set all our member variables based on input: //TODO: Organize and validate input this.dte = (_DTE)Application; this.wz = f.GetWizardData(); this.solutionName = (string)contextParams[5]; this.projectName = (string)contextParams[1]; this.path = (string)contextParams[2]; this.projectType = (ProjectType)wz.Type.ProjectTemplate; this.createNewSolution = (bool)contextParams[4]; // Parse project path and solution path from "path" //TODO: Can "path" be null/empty? this.projectPath = this.path; if (this.createNewSolution) { this.solutionPath = path.Substring(0, this.path.Length - this.projectName.Length - 1); } else { this.solutionPath = Path.GetDirectoryName(this.dte.Solution.FullName); } // Create a Project based on all our input: retval = createProject() ? wizardResult.wizardResultSuccess : wizardResult.wizardResultFailure; } else { retval = wizardResult.wizardResultCancel; } } catch (System.Exception ex) { MessageBox.Show("Exception: " + ex.Message, "Error"); retval = wizardResult.wizardResultBackOut; } }
private void PaintPanels() { switch (iCurIndex) { case 0: bPrevious.Visible = false; bPrevious.Enabled = false; break; default: bPrevious.Visible = true; bPrevious.Enabled = true; break; } for (int i = 0; i < pucList.Length; i++) { pucList[i].Visible = false; pucList[i].Enabled = false; } if (iCurIndex == 1) { ((ucSubmodules)pucList[1]).setRequiredSubmodule("Dynamic Libraries"); } if (iCurIndex == 1 && ((ucType)pucList[0]).GetData().ProjectTemplate == 2) { ((ucSubmodules)pucList[1]).setRequiredSubmodule("Windows Template Library (WTL)"); } if (iCurIndex == 3) { WizardData wz = new WizardData(); wz.Type = ((ucType)pucList[0]).GetData(); wz.SubmodulesAr = ((ucSubmodules)pucList[1]).GetData(); wz.Author = ((ucAuthorBlock)pucList[2]).GetData(); ((ucConfirmation)pucList[iCurIndex]).PrintResults(wz); } pucList[iCurIndex].Visible = true; pucList[iCurIndex].Enabled = true; }
public void PrintResults(WizardData wd) { StringBuilder sb = new StringBuilder(); sb.Append("Project Settings:\r\n"); sb.Append("Project Type - " + wd.Type.projectTemplateString + "\r\n"); sb.Append("Location of Main - " + wd.Type.MainLocation + "\r\n"); sb.Append("Location of Origin - " + wd.Type.OriginLocation + "\r\n"); sb.Append("\r\nDesired Submodules:\r\n"); bool bHasSubmodule = false; foreach (WizData_Submodules i in wd.SubmodulesAr) { bHasSubmodule = true; sb.Append("- " + i.Name + "\r\n"); } if (!bHasSubmodule) { sb.Append("NONE\r\n"); } sb.Append("\r\nAuthor Block:\r\n"); sb.Append("Project Name - " + wd.Author.ProjectName + "\r\n"); sb.Append("Requirement Number - " + wd.Author.RequirementNum + "\r\n"); sb.Append("Customer - " + wd.Author.Customer + "\r\n"); sb.Append("Office - " + wd.Author.Office + "\r\n"); sb.Append("Author - " + wd.Author.Author + "\r\n"); sb.Append("Version - " + wd.Author.Version + "\r\n"); sb.Append("Description - " + wd.Author.Description + "\r\n"); sb.Append("Status - " + wd.Author.Status + "\r\n"); sb.Append("Employee ID - " + wd.Author.EmpId); this.txtConfirm.Text = sb.ToString(); }