public Margin(IWpfTextView wpfTextView, MarkdownPackage package, ITextDocumentFactoryService textDocumentFactoryService) { this.textView = wpfTextView; this.package = package; this.Orientation = System.Windows.Controls.Orientation.Horizontal; this.Background = Brushes.SlateGray; this.Height = 25; Button showPreview = new Button() { Content = "Show preview window" }; showPreview.Click += HandleShowPreviewClick; this.Children.Add(showPreview); sectionCombo = new ComboBox(); sectionCombo.SelectionChanged += HandleSectionComboSelectionChanged; this.Children.Add(sectionCombo); backgroundParser = textView.TextBuffer.Properties.GetOrCreateSingletonProperty(typeof(MarkdownBackgroundParser), () => new MarkdownBackgroundParser(textView.TextBuffer, TaskScheduler.Default, textDocumentFactoryService)); sections = new List <MarkdownSection>(); backgroundParser.ParseComplete += HandleBackgroundParseComplete; backgroundParser.RequestParse(true); textView.Closed += HandleTextViewClosed; textView.Caret.PositionChanged += HandleTextViewCaretPositionChanged; }
public OutliningTagger(ITextBuffer buffer, OutliningTaggerProvider provider) { _dispatcher = Dispatcher.CurrentDispatcher; _buffer = buffer; _backgroundParser = buffer.Properties.GetOrCreateSingletonProperty(typeof(MarkdownBackgroundParser), () => new MarkdownBackgroundParser(buffer, TaskScheduler.Default, provider.TextDocumentFactoryService)); _sections = new List <MarkdownSection>(); _backgroundParser.ParseComplete += HandleBackgroundParseComplete; _backgroundParser.RequestParse(true); }
public Margin(IWpfTextView wpfTextView, MarkdownPackage package, ITextDocumentFactoryService textDocumentFactoryService) { this.textView = wpfTextView; this.package = package; base.Background = Brushes.SlateGray; StackPanel outlinePanel = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Height = 25 }; Button showPreview = new Button { Content = "Show preview window" }; showPreview.Click += HandleShowPreviewClick; outlinePanel.Children.Add(showPreview); Button copyHtml = new Button { Content = "Copy HTML to clipboard" }; copyHtml.Click += HandleCopyHtmlClick; outlinePanel.Children.Add(copyHtml); sectionCombo = new ComboBox(); sectionCombo.SelectionChanged += HandleSectionComboSelectionChanged; outlinePanel.Children.Add(sectionCombo); backgroundParser = textView.TextBuffer.Properties.GetOrCreateSingletonProperty(typeof(MarkdownBackgroundParser), () => new MarkdownBackgroundParser(textView.TextBuffer, TaskScheduler.Default, textDocumentFactoryService)); StackPanel rulesetPanel = new StackPanel { Orientation = Orientation.Horizontal }; Label rulesetLabel = new Label { Content = "Ruleset File: ", Foreground = Brushes.White }; rulesetPanel.Children.Add(rulesetLabel); Label rulesetPathLabel = new Label { Content = string.IsNullOrWhiteSpace(backgroundParser.RulesetFilePath) ? "Not Loaded" : backgroundParser.RulesetFilePath, ToolTip = backgroundParser.NoRulesetFileReason, Foreground = Brushes.White }; rulesetPanel.Children.Add(rulesetPathLabel); Expander optionsExpander = new Expander() { Header = outlinePanel, Content = rulesetPanel }; this.Children.Add(optionsExpander); sections = new List<MarkdownSection>(); backgroundParser.ParseComplete += HandleBackgroundParseComplete; backgroundParser.RequestParse(true); textView.Closed += HandleTextViewClosed; textView.Caret.PositionChanged += HandleTextViewCaretPositionChanged; }