Exemplo n.º 1
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            MarkdownPackage package = null;

            // If there is a shell service (which there should be, in VS), force the markdown package to load
            IVsShell shell = GlobalServiceProvider.GetService(typeof(SVsShell)) as IVsShell;

            if (shell != null)
            {
                package = MarkdownPackage.ForceLoadPackage(shell);
            }

            return(new Margin(wpfTextViewHost.TextView, package));
        }
Exemplo n.º 2
0
        public void  TextViewCreated(IWpfTextView textView)
        {
            MarkdownPackage package = null;

            // If there is a shell service (which there should be, in VS), force the markdown package to load
            IVsShell shell = GlobalServiceProvider.GetService(typeof(SVsShell)) as IVsShell;

            if (shell != null)
            {
                package = MarkdownPackage.ForceLoadPackage(shell);
            }

            if (package == null)
            {
                return;
            }

            textView.Properties.GetOrCreateSingletonProperty(() => new PreviewWindowUpdateListener(textView, package, TextDocumentFactoryService));
        }
        public void  TextViewCreated(IWpfTextView textView)
        {
            ITextDocument document;

            if (!textView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document))
            {
                document = null;
            }

            MarkdownPackage package = null;

            // If there is a shell service (which there should be, in VS), force the markdown package to load
            IVsShell shell = GlobalServiceProvider.GetService(typeof(SVsShell)) as IVsShell;

            if (shell != null)
            {
                package = MarkdownPackage.ForceLoadPackage(shell);
            }

            textView.Properties.GetOrCreateSingletonProperty(() => new PreviewWindowUpdateListener(textView, package, document));
        }