public PreviewWindowUpdateListener(IWpfTextView wpfTextView, MarkdownPackage package, ITextDocumentFactoryService textDocumentFactoryService)
        {
            this.textView = wpfTextView;
            this.package = package;
            this.backgroundParser = new PreviewWindowBackgroundParser(wpfTextView.TextBuffer, TaskScheduler.Default, textDocumentFactoryService);
            this.backgroundParser.ParseComplete += HandleBackgroundParseComplete;

            if (!textDocumentFactoryService.TryGetTextDocument(wpfTextView.TextDataModel.DocumentBuffer, out document))
                document = null;

            if (textView.HasAggregateFocus)
                UpdatePreviewWindow(string.Empty);

            backgroundParser.RequestParse(true);

            textView.Closed += HandleTextViewClosed;
            textView.GotAggregateFocus += HandleTextViewGotAggregateFocus;
        }
Example #2
0
        public PreviewWindowUpdateListener(IWpfTextView wpfTextView, MarkdownPackage package, ITextDocumentFactoryService textDocumentFactoryService)
        {
            this.textView         = wpfTextView;
            this.package          = package;
            this.backgroundParser = new PreviewWindowBackgroundParser(wpfTextView.TextBuffer, TaskScheduler.Default, textDocumentFactoryService);
            this.backgroundParser.ParseComplete += HandleBackgroundParseComplete;

            if (!textDocumentFactoryService.TryGetTextDocument(wpfTextView.TextDataModel.DocumentBuffer, out document))
            {
                document = null;
            }

            if (textView.HasAggregateFocus)
            {
                UpdatePreviewWindow(string.Empty);
            }

            backgroundParser.RequestParse(true);

            textView.Closed            += HandleTextViewClosed;
            textView.GotAggregateFocus += HandleTextViewGotAggregateFocus;
        }