public static EnvDTE.Document GetDocument(this DTE2 dte) { if (dte.HasActiveDocument()) { return((dte.ActiveDocument.DTE)?.ActiveDocument); } return(null); }
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; } } }