// TODO //private void ButtonQueryStatus(object sender, EventArgs e) //{ // var button = (MenuCommand)sender; // button.Visible = false; // _serviceInfo.GetSelectedProjects(); //} /// <summary> /// Click on the button 'Adjust namespaces'. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuItemCallback(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); try { var selectedItemPaths = _serviceInfo.SolutionSelectionService.GetSelectedItemsPaths(); var allPaths = _serviceInfo.InnerPathFinder.GetAllInnerPaths(selectedItemPaths); if (!allPaths.Any()) { return; } var solutionFile = _package.GetSolutionFile(); var projectFile = ProjectHelper.GetProjectFilePath(allPaths[0]); _namespaceBuilder = NamespaceBuilderFactory.CreateNamespaceBuilderService(projectFile.Extension, _package.GetOptionPage()); allPaths.ToList().ForEach(f => FixNamespace(f, solutionFile, projectFile)); } finally { MsBuildEvaluationHelper.ClearCache(); } }
/// <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 selectedItemPaths = _solutionSelectionService.GetSelectedItemsPaths(); var allPaths = _innerPathFinder.GetAllInnerPaths(selectedItemPaths); if (!allPaths.Any()) { return; } var projectFile = ProjectHelper.GetProjectFilePath(allPaths[0]); var solutionFile = ProjectHelper.GetSolutionFilePath(projectFile.Directory.FullName); _namespaceBuilder = ServiceFactory.CreateNamespaceBuilderService(projectFile.Extension, _options); allPaths.ToList().ForEach(f => FixNamespace(f, solutionFile, projectFile)); }