Esempio n. 1
0
        public IWpfTextViewHost GetCurrentViewHost(Func <string, bool> predicate)
        {
            IWpfTextViewHost viewHost = VisualStudioInteraction.GetCurrentViewHost(_serviceProvider);

            if (viewHost == null)
            {
                return(null);
            }

            ITextDocument textDocument = viewHost.GetTextDocument();

            if (textDocument == null || !predicate(textDocument.FilePath))
            {
                return(null);
            }

            return(viewHost);
        }
Esempio n. 2
0
        public static IWpfTextViewHost GetCurrentViewHost(IServiceProvider serviceProvider, Func <string, bool> predicate)
        {
            IWpfTextViewHost viewHost = GetCurrentViewHost(serviceProvider);

            if (viewHost == null)
            {
                return(null);
            }

            ITextDocument textDocument = viewHost.GetTextDocument();

            if (textDocument == null || !predicate(textDocument.FilePath))
            {
                return(null);
            }

            return(viewHost);
        }
Esempio n. 3
0
        static IWpfTextViewHost GetCurrentVBViewHost(IServiceProvider serviceProvider)
        {
            IWpfTextViewHost viewHost = VisualStudioInteraction.GetCurrentViewHost(serviceProvider);

            if (viewHost == null)
            {
                return(null);
            }

            ITextDocument textDocument = viewHost.GetTextDocument();

            if ((textDocument == null) || !IsVBFileName(textDocument.FilePath))
            {
                return(null);
            }

            return(viewHost);
        }