/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private void MenuItemCallback(object sender, EventArgs e) { var dte = (DTE2)GetService(typeof(DTE)); // New wizard var codeGenerator = new CodeGenerationWizard(); codeGenerator.Execute(dte.Solution); }
/// <summary>Launch code generation wizard </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Args</param> private void cmdLaunch_Click(object sender, EventArgs e) { // Open requested solution try { dte2.Solution.Open(txtSolution.Text); } catch (Exception ex) { // Error opening entered solution MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Invoke Code Generation wizard var wizard = new CodeGenerationWizard(); wizard.Execute(dte2.Solution); // Close solution upon return from wizard dte2.Solution.Close(); }