Пример #1
0
        public static EnvDTE.Document GetDocument(this DTE2 dte)
        {
            if (dte.HasActiveDocument())
            {
                return((dte.ActiveDocument.DTE)?.ActiveDocument);
            }

            return(null);
        }
Пример #2
0
        private void Command_QueryStatus(object sender, EventArgs e)
        {
            if (sender is OleMenuCommand menuCommand)
            {
                menuCommand.Enabled   = false;
                menuCommand.Supported = false;

                if (dte.HasActiveDocument())
                {
                    menuCommand.Enabled   = dte.ActiveWindow.HWnd == dte.ActiveDocument.ActiveWindow.HWnd;
                    menuCommand.Supported = true;
                }
            }
        }