예제 #1
0
        private void MenuItemCallback(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var selectedItems = (ServiceProvider.GetService(typeof(SDTE)) as DTE2)?.SelectedItems;

            if (selectedItems == null || selectedItems.Count == 0)
            {
                return;
            }

            FileInfo      path         = null;
            DirectoryInfo solutionPath = new DirectoryInfo(Path.GetPathRoot(Environment.SystemDirectory));

            try
            {
                var solutionFile = ProjectSettings.GetSolutionPath((ServiceProvider.GetService(typeof(SDTE)) as DTE2)?.Solution);
                solutionPath = solutionFile.Directory;

                foreach (SelectedItem selectedItem in selectedItems)
                {
                    path = ProjectSettings.GetSelectedItemPath(selectedItem);
                }
            }
            catch (FileNotFoundException)
            {
                path = ProjectSettings.LookingForSelectedItem(this.ServiceProvider);
            }

            Powershell.Show(path, solutionPath);
        }
        private void MenuItemCallback(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var selectedItems = (ServiceProvider.GetService(typeof(SDTE)) as DTE2)?.SelectedItems;

            if (selectedItems == null || selectedItems.Count == 0)
            {
                return;
            }

            var path = ProjectSettings.GetSolutionPath((ServiceProvider.GetService(typeof(SDTE)) as DTE2)?.Solution);

            Powershell.Show(path, null);
        }
        private void MenuItemCallback(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var selectedItems = (ServiceProvider.GetService(typeof(SDTE)) as DTE2)?.SelectedItems;

            if (selectedItems == null || selectedItems.Count == 0)
            {
                return;
            }

            var solutionPath = ProjectSettings.GetSolutionPath((ServiceProvider.GetService(typeof(SDTE)) as DTE2)?.Solution);

            foreach (SelectedItem selectedItem in selectedItems)
            {
                if (selectedItem.Project == null)
                {
                    continue;
                }

                var path = ProjectSettings.GetOutputFileName(selectedItem.Project);
                Powershell.Show(path, solutionPath.Directory);
            }
        }