コード例 #1
0
ファイル: DebugViewPackageTool.cs プロジェクト: zy26/tytannet
        void ItemCodeJump(DebugViewTool sender, DebugViewData data, DbgViewCodeJumpStyle style)
        {
            bool found             = false;
            DTE2 applicationObject = parent.DTE;

            if (applicationObject == null)
            {
                throw new ArgumentNullException(null, "Invalid VisualStudio IDE application object.");
            }

            // get the projects:
            int             projectCount = applicationObject.Solution.Projects.Count;
            IList <Project> projects     = new List <Project>();

            for (int p = 1; p <= projectCount; p++)
            {
                projects.Add(applicationObject.Solution.Projects.Item(p));
            }

            // search:
            if (style != DbgViewCodeJumpStyle.Automatic && style != DbgViewCodeJumpStyle.Autodetect)
            {
                found = SolutionHelper.Activate(projects, SolutionHelper.GetFinder(data.Message, style));
            }
            else
            {
                IList <DbgViewCodeJumpStyle> list = new List <DbgViewCodeJumpStyle>();

                list.Add(DbgViewCodeJumpStyle.Class_12);
                list.Add(DbgViewCodeJumpStyle.Class_23);
                list.Add(DbgViewCodeJumpStyle.Class_34);
                list.Add(DbgViewCodeJumpStyle.Class_45);
                list.Add(DbgViewCodeJumpStyle.Class_56);
                list.Add(DbgViewCodeJumpStyle.Class_1);
                list.Add(DbgViewCodeJumpStyle.Class_2);
                list.Add(DbgViewCodeJumpStyle.Class_3);
                list.Add(DbgViewCodeJumpStyle.Class_4);
                list.Add(DbgViewCodeJumpStyle.Class_5);

                // try guess the style:
                foreach (DbgViewCodeJumpStyle e in list)
                {
                    if (SolutionHelper.Activate(projects, SolutionHelper.GetFinder(data.Message, e)))
                    {
                        if (style == DbgViewCodeJumpStyle.Autodetect)
                        {
                            control.SetStyle(e);
                        }

                        found = true;
                        break;
                    }
                }
            }

            if (!found)
            {
                MessageBox.Show("Specific element doesn't contain reference to the code inside current solution.", DebugViewTool.DialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }