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();
            }
        }
Example #2
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();
            }
        }