Exemplo n.º 1
0
            //DOC: Documentation Required
            /// <summary>
            ///
            /// </summary>
            public void Start(object state)
            {
                // Process the global template
                Article.Article art = new MohawkCollege.EHR.gpmr.Pipeline.Renderer.Deki.Article.Article();

                //if (FeatureTemplate.Feature.Contains(".SubSystem"))
                //    System.Diagnostics.Debugger.Break();

                // Process the global template

                art.Content  = FeatureTemplate.FillTemplate();
                art.Title    = FeatureTemplate.GetTitle();
                art.Name     = FeatureTemplate.Context is Feature ? (FeatureTemplate.Context as Feature).Name : art.Title;
                art.Abstract = FeatureTemplate.GetAbstract();
                string ParentName = FeatureTemplate.GetPath();

                // Modify the article collection
                lock (ArticleCollection)
                {
                    // See if master appears anywhere?
                    if (ParentName == null && ArticleCollection.Find(ParentName) == null)
                    {
                        ArticleCollection.Add(art);
                    }
                    else if (ParentName == null)
                    {
                        foreach (Article.Article cart in ArticleCollection.Find(ParentName).Children ?? new ArticleCollection())
                        {
                            art.Children.Add(cart);
                        }

                        ArticleCollection.Remove(ArticleCollection.Find(ParentName));
                        ArticleCollection.Add(art);
                    }
                    else if (ArticleCollection.Find(ParentName) != null)
                    {
                        if (ArticleCollection.Find(ParentName).Children == null)
                        {
                            ArticleCollection.Find(ParentName).Children = new ArticleCollection();
                        }

                        ArticleCollection.Find(ParentName).Children.Add(art);
                    }
                    else
                    {
                        Article.Article Parent = new MohawkCollege.EHR.gpmr.Pipeline.Renderer.Deki.Article.Article();
                        Parent.Title    = ParentName;
                        Parent.Children = new ArticleCollection();
                        ArticleCollection.Add(Parent);
                        Parent.Children.Add(art);
                    }
                }

                if (this.OnComplete != null)
                {
                    OnComplete(this, new EventArgs());
                }
            }
Exemplo n.º 2
0
        /// <summary>
        /// Generate the TOC
        /// </summary>
        private void PrepareTOC(Article.Article artc)
        {
            // Create a TOC Article
            Article.Article tocArticle = artc;

            FeatureTemplate tocTemplate = NonParameterizedTemplate.Spawn(FindTemplate(tocArticle.GetType().FullName, tocArticle), this, tocArticle) as FeatureTemplate;

            tocArticle.Title = tocArticle.Title ?? tocTemplate.GetTitle();

            // Populate Toc Article
            tocArticle.Content = globalTemplate.FillTemplate(tocTemplate);

            // Create child TOC if they are empty
            if (tocArticle.Children != null)
            {
                for (int i = 0; i < tocArticle.Children.Count; i++)
                {
                    PrepareTOC(tocArticle.Children.Data[i]);
                }
            }
        }