当前位置: 首页>>代码示例>>C#>>正文


C# IContent类代码示例

本文整理汇总了C#中IContent的典型用法代码示例。如果您正苦于以下问题:C# IContent类的具体用法?C# IContent怎么用?C# IContent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IContent类属于命名空间,在下文中一共展示了IContent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PagesController

 /// <summary>
 /// Initializes a new instance of the <b>PagesController</b> class.
 /// </summary>
 /// <param name="structureInfo">The structure info.</param>
 /// <param name="currentPage">The current page.</param>
 /// <param name="session">The session.</param>
 /// <param name="content">The content.</param>
 public PagesController(IStructureInfo structureInfo, IPageModel currentPage, IDocumentSession session, IContent content)
 {
     _structureInfo = structureInfo;
     _currentPage = currentPage;
     _session = session;
     _content = content;
 }
开发者ID:bbqchickenrobot,项目名称:brickpile,代码行数:14,代码来源:PagesController.cs

示例2: UmbracoDataMappingContext

 /// <summary>
 /// Initializes a new instance of the <see cref="UmbracoDataMappingContext"/> class.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="content">The content.</param>
 /// <param name="service">The service.</param>
 public UmbracoDataMappingContext(object obj, IContent content, IUmbracoService service, bool publishedOnly)
     : base(obj)
 {
     Content = content;
     Service = service;
     PublishedOnly = publishedOnly;
 }
开发者ID:JamesHay,项目名称:Glass.Mapper,代码行数:13,代码来源:UmbracoDataMappingContext.cs

示例3: ListImpulses

        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;
        }
开发者ID:akhurst,项目名称:ricealumni,代码行数:33,代码来源:ImpulseService.cs

示例4: Serialise

        public RuntimeContentModel Serialise(IContent content)
        {
            var publishedContent = _umbracoHelper.TypedContent(content.Id);

            if (publishedContent == null)
                return null;     

            var runtimeContent = Mapper.Map<RuntimeContentModel>(publishedContent);

            runtimeContent.Url = RemovePortFromUrl(publishedContent.UrlWithDomain());
            runtimeContent.RelativeUrl = publishedContent.Url;
            runtimeContent.CacheTime = null;

            runtimeContent.Type = publishedContent.DocumentTypeAlias;

            runtimeContent.Template = publishedContent.GetTemplateAlias();

            runtimeContent.Content = new Dictionary<string, object>();

            foreach (var property in content.Properties)
            {
                if (!runtimeContent.Content.ContainsKey(property.Alias))
                    runtimeContent.Content.Add(property.Alias, property.Value);
            }

            foreach (var contentParser in _contentParsers)
            {
                runtimeContent = contentParser.ParseContent(runtimeContent);
            }
            
            RuntimeContext.Instance.ContentService.AddContent(runtimeContent);
            return runtimeContent;
        }
开发者ID:iahdevelop,项目名称:moriyama-umbraco-runtime,代码行数:33,代码来源:UmbracoContentSerialiser.cs

示例5: Write

        public Task Write(IContent content, Stream outputStream)
        {
            if (content.Model != null)
            {
                var enumerable = content.Model as IEnumerable<object>;
                if (enumerable != null)
                {
                    WriteList(outputStream, enumerable);
                }
                else
                {
                    var links = content.Links.ToList();
                    if (links.Count == 0)
                    {
                        new DataContractSerializer(content.Model.GetType()).WriteObject(outputStream, content.Model);
                    }
                    else
                    {
                        WriteWithLinks(content, outputStream, links);
                    }
                }
            }

            return TaskHelper.Completed();
        }
开发者ID:samsalisbury,项目名称:Simple.Web,代码行数:25,代码来源:XmlMediaTypeHandler.cs

示例6: ItemInspector

 public ItemInspector(IContent item, ContentItemMetadata metadata) {
     _item = item;
     _metadata = metadata;
     _common = item.Get<ICommonAspect>();
     _routable = item.Get<RoutableAspect>();
     _body = item.Get<BodyAspect>();
 }
开发者ID:mofashi2011,项目名称:orchardcms,代码行数:7,代码来源:ItemInspector.cs

示例7: Slugify

 public string Slugify(IContent content)
 {
     var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
     if (metadata == null) return null;
     var title = metadata.DisplayText.Trim();
     return Slugify(new FillSlugContext(content,title));
 }
开发者ID:Log-of-e,项目名称:orchard_cms_view_code,代码行数:7,代码来源:DefaultSlugService.cs

示例8:

        void ILocalizationService.SetContentCulture(IContent content, string culture) {
            var localized = content.As<LocalizationPart>();
            if (localized == null || localized.MasterContentItem == null)
                return;

            localized.Culture = _cultureManager.GetCultureByName(culture);
        }
开发者ID:sjbisch,项目名称:Orchard,代码行数:7,代码来源:LocalizationService.cs

示例9: GenerateXml

        /// <summary>
        /// The generate xml.
        /// </summary>
        /// <param name="page">
        /// The page.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string GenerateXml(IContent page)
        {
            if (page == null)
            {
                return string.Empty;
            }

            XDocument xDocument = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), new object[0]);

            XElement xElement = new XElement("content");
            xElement.SetAttributeValue("name", XmlConvert.EncodeName(page.Name));

            List<KeyValuePair<string, string>> propertyValues = page.GetPropertyValues();

            foreach (KeyValuePair<string, string> content in propertyValues)
            {
                XElement xElement3 = new XElement(XmlConvert.EncodeName(content.Key));
                xElement3.SetValue(TextIndexer.StripHtml(content.Value, content.Value.Length));
                xElement.Add(xElement3);
            }

            xDocument.Add(xElement);

            return xDocument.ToString();
        }
开发者ID:jstemerdink,项目名称:EPiServer.Libraries,代码行数:34,代码来源:XmlOutputFormat.cs

示例10: ContentValueChangedActionItem

 /// <summary>
 /// Initializes a new instance of the <see cref="ContentValueChangedActionItem"/> class.
 /// </summary>
 /// <param name="name">The name of this action item.</param>
 /// <param name="content">The <see cref="IContent"/> instance that has changed.</param>
 /// <param name="index">The index of the change if the change occurred on an item of a collection. <c>null</c> otherwise.</param>
 /// <param name="previousValue">The previous value of the content (or the item if the change occurred on an item of a collection).</param>
 /// <param name="dirtiables">The dirtiable objects associated to this action item.</param>
 public ContentValueChangedActionItem(string name, IContent content, object index, object previousValue, IEnumerable<IDirtiable> dirtiables)
     : base(name, dirtiables)
 {
     this.Content = content;
     PreviousValue = previousValue;
     Index = index;
 }
开发者ID:FERRERDEV,项目名称:xenko,代码行数:15,代码来源:ContentValueChangedActionItem.cs

示例11: SetupViewModel

        public void SetupViewModel(FrontendContext frontendContext, IContent node, NodeViewModel viewModel)
        {
            if (node.ContentItem.ContentType != "WikipediaPage") return;

            viewModel.name = node.As<ITitleAspect>().Title;
            viewModel.data["url"] = node.As<WikipediaPagePart>().Url;
        }
开发者ID:Lombiq,项目名称:Associativy-Wikipedia-Instance,代码行数:7,代码来源:JitConfigurationHandler.cs

示例12: GenerateJson

        /// <summary>
        /// Generate the json output for the page.
        /// </summary>
        /// <param name="page">
        /// The page.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string GenerateJson(IContent page)
        {
            string json;

            List<KeyValuePair<string, string>> propertyValues = page.GetPropertyValues();

            StringBuilder stringBuilder = new StringBuilder();

            using (StringWriter sw = new StringWriter(stringBuilder, CultureInfo.InvariantCulture))
            {
                JsonWriter jsonWriter = new JsonTextWriter(sw) { Formatting = Formatting.Indented };

                jsonWriter.WriteStartObject();

                jsonWriter.WritePropertyName(page.Name);

                jsonWriter.WriteStartObject();

                foreach (KeyValuePair<string, string> content in propertyValues)
                {
                    jsonWriter.WritePropertyName(content.Key);
                    jsonWriter.WriteValue(TextIndexer.StripHtml(content.Value, content.Value.Length));
                }

                jsonWriter.WriteEndObject();

                jsonWriter.WriteEndObject();

                json = sw.ToString();
            }

            return json;
        }
开发者ID:jstemerdink,项目名称:EPiServer.Libraries,代码行数:42,代码来源:JsonOutputFormat.cs

示例13: UpdateEditorContext

 public UpdateEditorContext(IShape model, IContent content, IUpdateModel updater, string groupInfoId, IShapeFactory shapeFactory, ShapeTable shapeTable, string path)
     : base(model, content, groupInfoId, shapeFactory) {
     
     ShapeTable = shapeTable;
     Updater = updater;
     Path = path;
 }
开发者ID:anycall,项目名称:Orchard,代码行数:7,代码来源:UpdateEditorContext.cs

示例14: GetMarkup

        /// <summary>
        /// Gets the markup for the tag based upon the passed in parameters.
        /// </summary>
        /// <param name="currentPage">The current page.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        public override string GetMarkup(IContent currentPage, IDictionary<string, string> parameters)
        {
            var email = parameters["email"];
            var text = email;

            if (parameters.ContainsKey("subject"))
                email += ((email.IndexOf("?", StringComparison.InvariantCulture) == -1) ? "?" : "&") + "subject=" + parameters["subject"];

            if (parameters.ContainsKey("body"))
                email += ((email.IndexOf("?", StringComparison.InvariantCulture) == -1) ? "?" : "&") + "body=" + parameters["body"];

            var sb = new StringBuilder();
            sb.AppendFormat("<a href=\"mailto:{0}\"", email); // TODO: HTML encode

            if (parameters.ContainsKey("title"))
                sb.AppendFormat(" title=\"{0}\"", parameters["title"]);

            if (parameters.ContainsKey("class"))
                sb.AppendFormat(" class=\"{0}\"", parameters["class"]);

            sb.Append(">");
            sb.Append(parameters.ContainsKey("text")
                ? parameters["text"]
                : text);

            sb.Append("</a>");

            return sb.ToString();
        }
开发者ID:TSalaam,项目名称:karbon-cms,代码行数:35,代码来源:EmailTag.cs

示例15: ExecuteSync

 protected override void ExecuteSync(IContent content, Index index, object parameter)
 {
     var value = content.Retrieve(index);
     var collectionDescriptor = (CollectionDescriptor)TypeDescriptorFactory.Default.Find(value.GetType());
     object itemToAdd = null;
     // TODO: Find a better solution for ContentSerializerAttribute that doesn't require to reference Core.Serialization (and unreference this assembly)
     if (collectionDescriptor.ElementType.IsAbstract || collectionDescriptor.ElementType.IsNullable() || collectionDescriptor.ElementType.GetCustomAttributes(typeof(ContentSerializerAttribute), true).Any())
     {
         // If the parameter is a type instead of an instance, try to construct an instance of this type
         var type = parameter as Type;
         if (type?.GetConstructor(Type.EmptyTypes) != null)
             itemToAdd = Activator.CreateInstance(type);
     }
     else if (collectionDescriptor.ElementType == typeof(string))
     {
         itemToAdd = parameter ?? "";
     }
     else
     {
         itemToAdd = parameter ?? ObjectFactory.NewInstance(collectionDescriptor.ElementType);
     }
     if (index.IsEmpty)
     {
         content.Add(itemToAdd);
     }
     else
     {
         // Handle collections in collections
         // TODO: this is not working on the observable node side
         var collectionNode = content.Reference.AsEnumerable[index].TargetNode;
         collectionNode.Content.Add(itemToAdd);
     }
 }
开发者ID:cg123,项目名称:xenko,代码行数:33,代码来源:AddNewItemCommand.cs


注:本文中的IContent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。