예제 #1
0
        void HandleBackgroundParseComplete(object sender, ParseResultEventArgs e)
        {
            MarkdownParseResultEventArgs args        = e as MarkdownParseResultEventArgs;
            List <MarkdownSection>       newSections = args != null ? args.Sections : new List <MarkdownSection>();
            Action updateAction = () => RefreshComboItems(textView.TextBuffer.CurrentSnapshot, args.Sections);

            Dispatcher.BeginInvoke(updateAction);
        }
예제 #2
0
        protected virtual void OnParseComplete(ParseResultEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            var t = ParseComplete;

            if (t != null)
            {
                t(this, e);
            }
        }
        private void HandleBackgroundParseComplete(object sender, ParseResultEventArgs e)
        {
            PreviewParseResultEventArgs args = e as PreviewParseResultEventArgs;
            Action updateAction = () =>
            {
                try
                {
                    UpdatePreviewWindow(args != null ? args.Html : string.Empty);
                }
                catch (Exception ex)
                {
                    if (ErrorHandler.IsCriticalException(ex))
                        throw;
                }
            };

            textView.VisualElement.Dispatcher.BeginInvoke(updateAction);
        }
예제 #4
0
        private void HandleBackgroundParseComplete(object sender, ParseResultEventArgs e)
        {
            PreviewParseResultEventArgs args = e as PreviewParseResultEventArgs;
            Action updateAction = () =>
            {
                try
                {
                    UpdatePreviewWindow(args != null ? args.Html : string.Empty);
                }
                catch (Exception ex)
                {
                    if (ErrorHandler.IsCriticalException(ex))
                    {
                        throw;
                    }
                }
            };

            textView.VisualElement.Dispatcher.BeginInvoke(updateAction);
        }
예제 #5
0
        private void HandleBackgroundParseComplete(object sender, ParseResultEventArgs e)
        {
            MarkdownParseResultEventArgs args        = e as MarkdownParseResultEventArgs;
            List <MarkdownSection>       newSections = args != null ? args.Sections : new List <MarkdownSection>();

            ITextSnapshot snapshot = e.Snapshot;
            NormalizedSnapshotSpanCollection oldSectionSpans = new NormalizedSnapshotSpanCollection(
                _sections.Select(s => s.Span.GetSpan(snapshot)));
            NormalizedSnapshotSpanCollection newSectionSpans = new NormalizedSnapshotSpanCollection(
                newSections.Select(s => s.Span.GetSpan(snapshot)));

            NormalizedSnapshotSpanCollection difference = SymmetricDifference(oldSectionSpans, newSectionSpans);

            Action updateAction = () =>
            {
                try
                {
                    _sections = newSections;
                    foreach (var span in difference)
                    {
                        var temp = TagsChanged;
                        if (temp != null)
                        {
                            temp(this, new SnapshotSpanEventArgs(span));
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (ErrorHandler.IsCriticalException(ex))
                    {
                        throw;
                    }
                }
            };

            _dispatcher.BeginInvoke(updateAction);
        }
예제 #6
0
        protected virtual void OnParseComplete(ParseResultEventArgs e)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            var t = ParseComplete;
            if (t != null)
                t(this, e);
        }
예제 #7
0
 void HandleBackgroundParseComplete(object sender, ParseResultEventArgs e)
 {
     MarkdownParseResultEventArgs args = e as MarkdownParseResultEventArgs;
     List<MarkdownSection> newSections = args != null ? args.Sections : new List<MarkdownSection>();
     Action updateAction = () => RefreshComboItems(textView.TextBuffer.CurrentSnapshot, args.Sections);
     Dispatcher.BeginInvoke(updateAction);
 }