コード例 #1
0
        public PublishLaterPartHandler(
            IPublishLaterService publishLaterService,
            IPublishingTaskManager publishingTaskManager)
        {
            _publishLaterService = publishLaterService;

            OnLoading <PublishLaterPart>((context, part) => LazyLoadHandlers(part));
            OnVersioning <PublishLaterPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart));
            OnRemoved <PublishLaterPart>((context, part) => publishingTaskManager.DeleteTasks(part.ContentItem));
            OnPublishing <PublishLaterPart>((context, part) =>
            {
                var existingPublishTask = publishingTaskManager.GetPublishTask(context.ContentItem);

                //Check if there is already and existing publish task for old version.
                if (existingPublishTask != null)
                {
                    //If exists remove it in order no to override the latest published version.
                    publishingTaskManager.DeleteTasks(context.ContentItem);
                }
            });
        }
コード例 #2
0
        public DateTime?GetScheduledPublishUtc(BlogPostPart blogPostPart)
        {
            var task = _publishingTaskManager.GetPublishTask(blogPostPart.ContentItem);

            return(task == null ? null : task.ScheduledUtc);
        }
コード例 #3
0
        DateTime?IPublishLaterService.GetScheduledPublishUtc(PublishLaterPart publishLaterPart)
        {
            IScheduledTask task = _publishingTaskManager.GetPublishTask(publishLaterPart.ContentItem);

            return(task == null ? null : task.ScheduledUtc);
        }