/// <summary> /// Constructor from Article.Section /// </summary> /// <param name="section">Section to be displayed.</param> public IndexArticleSection(Article.Section section) { InitializeComponent(); this.SectionTitle.Text = section.Heading; string[] chunks = section.Text.Split('[', ']'); foreach (string chunk in chunks) { Run contents = new Run(chunk); if (chunk.StartsWith(Article.ArticleIdTag)) { Match m = RegexArticle.Match(chunk); if (m.Success) { contents.Text = m.Groups[ArticleTitleGroup].Value; Hyperlink link = new Hyperlink(contents); link.CommandParameter = uint.Parse(m.Groups[ArticleIdGroup].Value); this.SectionContents.Inlines.Add(link); } else { this.SectionContents.Inlines.Add(contents); } } else { this.SectionContents.Inlines.Add(contents); } } }
public void SetArticle(Article article) { this.ArticleTitle.Text = article.Name; this.Sections.Children.Clear(); foreach (Article.Section section in article.Contents) { this.Sections.Children.Add(new IndexArticleSection(section)); } }