Пример #1
0
        public IEnumerable<IImpulse> ListImpulses(IContent content, string displayType, object data = null)
        {
            var impulses = new List<ImpulseDisplayContext>();
            foreach (var impulse in GetDescriptors().Values) {

                if (!CheckDescriptor(impulse, content, data)) {
                    continue;
                }
                int? versionId = null;
                if (content.ContentItem.VersionRecord != null) versionId = content.ContentItem.VersionRecord.Id;
                var display = new ImpulseDisplayContext(impulse) {
                    Content = content,
                    DisplayType = displayType,
                    Data = data,
                    HrefRoute = new RouteValueDictionary(new {
                        action = "Actuate",
                        controller = "Impulse",
                        area = "Downplay.Mechanics",
                        name = impulse.Name,
                        returnUrl = Services.WorkContext.HttpContext.Request.RawUrl,
                        contentId = content.Id,
                        contentVersionId = versionId
                    })
                };
                                
                foreach (var e in impulse.DisplayingHandlers) {
                    e(display);
                }
                impulses.Add(display);

            }
            return impulses;
        }
Пример #2
0
        public IEnumerable <IImpulse> ListImpulses(IContent content, string displayType, object data = null)
        {
            var impulses = new List <ImpulseDisplayContext>();

            foreach (var impulse in GetDescriptors().Values)
            {
                if (!CheckDescriptor(impulse, content, data))
                {
                    continue;
                }
                int?versionId = null;
                if (content.ContentItem.VersionRecord != null)
                {
                    versionId = content.ContentItem.VersionRecord.Id;
                }
                var display = new ImpulseDisplayContext(impulse)
                {
                    Content     = content,
                    DisplayType = displayType,
                    Data        = data,
                    HrefRoute   = new RouteValueDictionary(new {
                        action           = "Actuate",
                        controller       = "Impulse",
                        area             = "Downplay.Mechanics",
                        name             = impulse.Name,
                        returnUrl        = Services.WorkContext.HttpContext.Request.RawUrl,
                        contentId        = content.Id,
                        contentVersionId = versionId
                    })
                };

                foreach (var e in impulse.DisplayingHandlers)
                {
                    e(display);
                }
                impulses.Add(display);
            }
            return(impulses);
        }