示例#1
0
        /// <inheritdoc cref="IQueueProcessor.Stop"/>
        public void Stop()
        {
            _Started = false;

            while (_RunningTasks.Any())
            {
                ClearFinishedTasks();
                Thread.Sleep(TimeSpan.FromMilliseconds(10));
            }
        }
示例#2
0
        private void AddMetaDataTagsFromArticle(DynamicContent dynamicContent)
        {
            Page.RemoveExistingPublishedTags();

            // add published date tags
            Page.AddCustomMetaTags("Published", dynamicContent.PublicationDate.ToString("yyyy-MM-dd'T'HH:mm:ss", CultureInfo.InvariantCulture));

            TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();

            if (dynamicContent.DoesFieldExist("Category"))
            {
                TrackedList <Guid> categoryIds = dynamicContent.GetValue("Category") as TrackedList <Guid>;
                if (categoryIds != null && categoryIds.Any())
                {
                    var categoryList = string.Join(",", categoryIds.Select(cid => taxonomyManager.GetTaxon(cid).Title));
                    Page.AddCustomMetaTags("webcategory", categoryList);
                }
            }

            if (dynamicContent.DoesFieldExist("resourcetypes"))
            {
                TrackedList <Guid> resourcetypesIds = dynamicContent.GetValue("resourcetypes") as TrackedList <Guid>;
                if (resourcetypesIds != null && resourcetypesIds.Any())
                {
                    var resourcetypesList = string.Join(",", resourcetypesIds.Select(cid => taxonomyManager.GetTaxon(cid).Title));
                    Page.AddCustomMetaTags("resourcetypes", resourcetypesList);
                }
            }

            Page.RemoveExistingModuleTags();
            string modulePage = dynamicContent.GetType().Name;

            try
            {
                if (!AppSettingsUtility.GetValue <string>("MetaDataTags.Article.Name").IsNullOrWhitespace())
                {
                    modulePage = AppSettingsUtility.GetValue <string>("MetaDataTags.Article.Name");
                }
            }
            catch (Exception)
            {
            }

            Page.AddCustomMetaTags("Module", modulePage);


            Type type;

            if (dynamicContent.SystemParentItem != null)
            {
                type = dynamicContent.SystemParentItem.GetType();
            }
            else
            {
                type = dynamicContent.GetType();
            }

            string articleType = type.FullName.Split('.')[4];

            //Could change this to work with On-Scene Articles...
            if (articleType.ToLower().Contains("healthprogress"))
            {
                Page.AddCustomMetaTags("Publication", "Health Progress");
                //Health Progress
            }

            if (dynamicContent.DoesFieldExist("author"))
            {
                var authorname = dynamicContent.Author;
                if (authorname != null)
                {
                    Page.AddCustomMetaTags("ContentAuthor", authorname);
                }
            }
            var authorsFieldName = "organizationalauthors";

            if (dynamicContent.DoesFieldExist(authorsFieldName))
            {
                TrackedList <Guid> authorIds = dynamicContent.GetValue(authorsFieldName) as TrackedList <Guid>;
                if (authorIds != null)
                {
                    var authorList = string.Join(",", authorIds.Select(cid => taxonomyManager.GetTaxon(cid).Title));
                    Page.AddCustomMetaTags("contentauthor", authorList);
                }
            }
        }