示例#1
0
        public static void Invoke(TargetAction action, CleanupOptions cleanupOptions)
        {
            try
            {
                var projects       = DteServiceProvider.Instance.ActiveSolutionProjects as Array;
                var currentProject = projects.GetValue(0) as Project;

                if (currentProject.ProjectItems == null)
                {
                    return;
                }

                if (currentProject.FullName.EndsWith(".shproj", StringComparison.OrdinalIgnoreCase))
                {
                    System.Windows.MessageBox
                    .Show("Clean up can't be called direlctly on Shared Project", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                for (var i = 1; i <= currentProject.ProjectItems.Count; i++)
                {
                    ActionCSharpOnProjectItem.Action(currentProject.ProjectItems.Item(i), action, cleanupOptions);
                }
            }
            catch (Exception e)
            {
                ErrorNotification.WriteErrorToOutputWindow(e);
                ErrorNotification.WriteErrorToFile(e);
                ProcessActions.GeeksProductivityToolsProcess();
            }
        }
示例#2
0
        public static void Invoke(TargetAction action, CleanupOptions cleanupOptions)
        {
            try
            {
                var projects = SolutionActions.FindProjects(DteServiceProvider.Instance);

                for (var i = 0; i < projects.Count; i++)
                {
                    var currentProject = projects[i];
                    if (currentProject.ProjectItems == null)
                    {
                        continue;
                    }
                    if (currentProject.FullName.ToLower().EndsWith(".shproj"))
                    {
                        continue;
                    }

                    for (var j = 1; j < currentProject.ProjectItems.Count; j++)
                    {
                        ActionCSharpOnProjectItem.Action(currentProject.ProjectItems.Item(j), action, cleanupOptions);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorNotification.EmailError(e);
                ProcessActions.GeeksProductivityToolsProcess();
            }
        }
示例#3
0
        public static void Invoke(TargetAction action, Definition.CodeCleanerType[] type)
        {
            try
            {
                var projects       = DteServiceProvider.Instance.ActiveSolutionProjects as Array;
                var currentProject = projects.GetValue(0) as Project;

                if (currentProject.ProjectItems == null)
                {
                    return;
                }
                if (currentProject.FullName.ToLower().EndsWith(".shproj"))
                {
                    MessageBox.Show("Clean up can't be called direlctly on Shared Project", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                for (var i = 1; i <= currentProject.ProjectItems.Count; i++)
                {
                    ActionCSharpOnProjectItem.Action(currentProject.ProjectItems.Item(i), action, type);
                }
            }
            catch (Exception e)
            {
                ErrorNotification.EmailError(e);
                ProcessActions.GeeksProductivityToolsProcess();
            }
        }
        public static void Invoke(TargetAction action, CleanupOptions cleanupOptions)
        {
            try
            {
                var projects = SolutionActions.FindProjects(DteServiceProvider.Instance);

                for (var i = 0; i < projects.Count; i++)
                {
                    var currentProject = projects[i];
                    if (currentProject.ProjectItems == null)
                    {
                        continue;
                    }
                    if (currentProject.FullName.EndsWith(".shproj", StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }

                    for (var j = 1; j < currentProject.ProjectItems.Count; j++)
                    {
                        ActionCSharpOnProjectItem.Action(currentProject.ProjectItems.Item(j), action, cleanupOptions);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorNotification.WriteErrorToFile(e);
                ErrorNotification.WriteErrorToOutputWindow(e);
                ProcessActions.GeeksProductivityToolsProcess();
            }
        }
示例#5
0
 private static void DoActionForItems(ProjectItems projectItems, TargetAction action, CodeCleanerType[] type)
 {
     for (int subItemIndex = 1; subItemIndex <= projectItems.Count; subItemIndex++)
     {
         var subItem = projectItems.Item(subItemIndex);
         ActionCSharpOnProjectItem.Action(subItem, action, type);
     }
 }
 private static void DoActionForItems(ProjectItems projectItems, TargetAction action, CleanupOptions cleanupOptions)
 {
     for (int subItemIndex = 1; subItemIndex <= projectItems.Count; subItemIndex++)
     {
         var subItem = projectItems.Item(subItemIndex);
         ActionCSharpOnProjectItem.Action(subItem, action, cleanupOptions);
     }
 }
        public static void Invoke(TargetAction action, CleanupOptions cleanupOptions)
        {
            try
            {
                var ideSelectedItems = DteServiceProvider.Instance.SelectedItems;

                for (int itemIndex = 1; itemIndex <= ideSelectedItems.Count; itemIndex++)
                {
                    var selectItem = ideSelectedItems.Item(itemIndex);

                    var selectedProjectItem = selectItem.ProjectItem;

                    if (selectedProjectItem != null)
                    {
                        if (selectedProjectItem.ProjectItems == null || selectedProjectItem.ProjectItems.Count == 0 && action != null)
                        {
                            action(selectedProjectItem, cleanupOptions, true);
                        }
                        else
                        {
                            ActionCSharpOnProjectItem.Action(selectedProjectItem, action, cleanupOptions);
                        }
                    }
                    else if (selectItem.Project != null)
                    {
                        ActionCSharpOnProject.Invoke(action, cleanupOptions);
                    }
                    else
                    {
                        ActionCSharpOnSolution.Invoke(action, cleanupOptions);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorNotification.WriteErrorToFile(e);
                ErrorNotification.WriteErrorToOutputWindow(e);
                ProcessActions.GeeksProductivityToolsProcess();
            }
        }
示例#8
0
        public static void Invoke(TargetAction action, Definition.CodeCleanerType[] type)
        {
            try
            {
                var ideSelectedItems = DteServiceProvider.Instance.SelectedItems;

                for (int itemIndex = 1; itemIndex <= ideSelectedItems.Count; itemIndex++)
                {
                    var selectItem = ideSelectedItems.Item(itemIndex);

                    var selectedProjectItem = selectItem.ProjectItem;

                    if (selectedProjectItem != null)
                    {
                        if (selectedProjectItem.ProjectItems == null || selectedProjectItem.ProjectItems.Count == 0)
                        {
                            action(selectedProjectItem, type, true);
                        }
                        else
                        {
                            ActionCSharpOnProjectItem.Action(selectedProjectItem, action, type);
                        }
                    }
                    else if (selectItem.Project != null)
                    {
                        ActionCSharpOnProject.Invoke(action, type);
                    }
                    else
                    {
                        ActionCSharpOnSolution.Invoke(action, type);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorNotification.EmailError(e);
                ProcessActions.GeeksProductivityToolsProcess();
            }
        }