/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { var items = GetSelectedSolutionExplorerItems(); if (items == null) { return; } var filePaths = items.Select(i => i.Object).Cast <ProjectItem>().Select(p => p.Properties.Item("FullPath").Value.ToString()); var output = new OutputDialog((DTE2)ServiceProvider.GetService(typeof(DTE)), filePaths) { HasMinimizeButton = false, HasMaximizeButton = false }; output.ShowModal(); //var projectItem = (ProjectItem)item.Object; //var filePath = projectItem.Properties.Item("FullPath").Value.ToString(); //var classDefinitions = new ConvertHelper().ParseFile(filePath).ToDictionary(c => c.Name, c => c); //foreach (var definition in classDefinitions) //{ // var content = CreateTsFile(classDefinitions, definition.Value); // var dlg = new SaveFileDialog // { // Filter = "Typescript file (.ts)|*.ts", // DefaultExt = "ts", // AddExtension = true // }; // var result = dlg.ShowDialog(); // // Process save file dialog box results // if (result == DialogResult.OK) // { // // Save document // File.WriteAllText(dlg.FileName, content); // } //} }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { var item = GetSelectedSolutionExplorerItem(); if (item == null) { return; } var projectItem = (ProjectItem)item.Object; var folderPath = projectItem.Properties.Item("FullPath").Value.ToString(); var output = new OutputDialog((DTE2)ServiceProvider.GetService(typeof(DTE)), folderPath) { HasMinimizeButton = false, HasMaximizeButton = false }; output.ShowModal(); }