示例#1
0
        public MultiPageAssemblyInstruction()
        {
            // Initialize sub objects.
            _snippets      = new SnippetInfoCollection();
            _pages         = new MultiPageCollection();
            PageMetadata   = new PageMetadata();
            SocialMetadata = new SocialMetadata();
            PageResources  = new PageResources();
            _localFields   = new LocalFieldCollection();

            //base.Initialize();
        }
        /// <summary>
        /// Creates field filters for the given SocialMetadata object.
        /// </summary>
        /// <param name="pai">An available PageAssemblyInstruction object to receive the field filters.</param>
        /// <param name="socialMetadata">The SocialMetadata object to provide the fields.</param>
        protected virtual void RegisterSocialMetadataFieldFilters(IPageAssemblyInstruction pai, SocialMetadata socialMetadata)
        {
            try
            {
                // check provided PageAssemblyInstruction
                if (pai == null)
                {
                    log.Warn("RegisterSocialMetadataFieldFilters(): null PageAssemblyInstruction provided.");

                    return;
                }

                // add commenting available field filter
                pai.AddFieldFilter("is_commenting_available", (name, data) =>
                {
                    data.Value = socialMetadata.IsCommentingAvailable.ToString();
                });

                // add field filters for any tags
                if (socialMetadata.Tags != null)
                {
                    foreach (SocialMetaTagData tag in socialMetadata.Tags)
                    {
                        RegisterSocialMetaTagFieldFilter(pai, tag);
                    }
                }
            }
            catch (Exception e)
            {
                log.Error("InitializeFieldFilters(): Exception encountered while initializing field filters.", e);
            }
        }