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


C# PublishedContent.PublishedPropertyType类代码示例

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


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

示例1: ConvertSourceToObject

        public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
        {
            if (source == null)
                return null;

            return Umbraco.TypedMedia(source);
        }
开发者ID:bgadiel,项目名称:tt,代码行数:7,代码来源:MediaPickerConverter.cs

示例2: ConvertDataToSource

    public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
    {
        if (source == null) return null;
        var sourceString = source.ToString();

        var links = JsonConvert.DeserializeObject<IEnumerable<LinksPickerItem>>(sourceString);

        foreach (var link in links)
        {
            try
            {
                link.Content = (
                    link.IsMedia
                    ? umbHelper.TypedMedia(link.Id)
                    : umbHelper.TypedContent(link.Id)
                );

                link.Url = link.Content.Url;
            }
            catch (Exception)
            {
            }

        }

        return links;
    }
开发者ID:7ASecond,项目名称:7ASecond-Web-Site,代码行数:27,代码来源:LinksPickerValueConverter.cs

示例3: ConvertDataToSource

        public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            try
            {
                if (source != null && !source.ToString().IsNullOrWhiteSpace())
                {
                    var oh = JsonConvert.DeserializeObject<Dictionary<DayOfWeek, WeekdayOpeningHours>>(source.ToString());
                    return oh;
                }
            }
            catch (Exception e)
            {
                LogHelper.Error<OpeningHoursValueConverter>("Error converting value", e);
            }

            // Create default model
            var dict = new Dictionary<DayOfWeek, WeekdayOpeningHours>();

            for (var i = 0; i < 7; i++)
            {
                dict.Add((DayOfWeek)i, new WeekdayOpeningHours());
            }

            return dict;
        }
开发者ID:mattbrailsford,项目名称:umbOpeningHours,代码行数:25,代码来源:WeekdayOpeningHoursValueConverter.cs

示例4: ConvertDataToSource

        public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            if (source == null) return null;
            var sourceString = source.ToString();

            return UmbracoContext.Current != null ? new MultiUrls(sourceString) : null;
        }
开发者ID:GertyEngrie,项目名称:umbraco-multi-url-picker,代码行数:7,代码来源:MultiUrlPickerValueConverter.cs

示例5: IsConverter

 public bool IsConverter(PublishedPropertyType propertyType) {
     return (
         propertyType.PropertyEditorAlias == "Skybrud.SelfService.Categories"
         ||
         propertyType.PropertyEditorAlias == "Skybrud.SelfService.List"
     );
 }
开发者ID:skybrud,项目名称:Skybrud.Umbraco.SelfService,代码行数:7,代码来源:SelfServicePropertyValueConverter.cs

示例6: ConvertDataToSource

        public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            // data is (both in database and xml):
            // <keyFeatureList>
            //    <values>
            //        <value>Strong</value>
            //        <value>Flexible</value>
            //        <value>Efficient</value>
            //    </values>
            // </keyFeatureList>

            var sourceString = source.ToString();
            if (string.IsNullOrWhiteSpace(sourceString)) return Enumerable.Empty<string>();

            var values = new List<string>();
            var pos = sourceString.IndexOf("<value>", StringComparison.Ordinal);
            while (pos >= 0)
            {
                pos += "<value>".Length;
                var npos = sourceString.IndexOf("<", pos, StringComparison.Ordinal);
                var value = sourceString.Substring(pos, npos - pos);
                values.Add(value);
                pos = sourceString.IndexOf("<value>", pos, StringComparison.Ordinal);
            }
            return values.ToArray();
        }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:26,代码来源:MultipleTextStringValueConverter.cs

示例7: XmlPublishedProperty

 public XmlPublishedProperty(PublishedPropertyType propertyType, bool isPreviewing, string propertyData)
     : this(propertyType, isPreviewing)
 {
     if (propertyData == null)
         throw new ArgumentNullException("propertyData");
     _xmlValue = propertyData;
 }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:7,代码来源:XmlPublishedProperty.cs

示例8: ConvertDataToSource

        /// <summary>
        /// The convert data to source.
        /// </summary>
        /// <param name="propertyType">
        /// The property type.
        /// </param>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="preview">
        /// The preview.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            var merchello = new MerchelloHelper();

            if (source == null)
                return null;

            var collectionKey = source.ToString();

            if (collectionKey.IsNullOrWhiteSpace())
            {
                var query = merchello.ProductContentQuery().Page(1).ItemsPerPage(10).OrderBy(ProductSortField.Name);

               //var defaultCollection = merchello.Query.Product.TypedProductContentSearch(1, 10);

                return new ProductContentListView(Guid.Empty, query.Execute().Items);
            }

            try
            {
                var key = new Guid(collectionKey);

                var query = merchello.ProductContentQuery().Page(1).ItemsPerPage(long.MaxValue).ConstrainByCollectionKey(key);

                return new ProductContentListView(key, query.Execute().Items);
            }
            catch (Exception ex)
            {
                MultiLogHelper.Error<ProductListViewValueConverter>("Failed to Convert Merchello.ProductListView property", ex);
                return null;
            }
        }
开发者ID:rustyswayne,项目名称:Merchello,代码行数:47,代码来源:ProductListViewValueConverter.cs

示例9: ConvertDataToSource

        /// <summary>
        /// Method to convert a property value to an instance
        /// of the ColorPalette class.
        /// </summary>
        /// <param name="propertyType">The current published property
        /// type to convert.</param>
        /// <param name="source">The original property data.</param>
        /// <param name="preview">True if in preview mode.</param>
        /// <returns>An instance of the ColorPalette class.</returns>
        public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            if (source == null)
                    return null;

                if (UmbracoContext.Current == null)
                    return null;

                var retval = new ColorPalette();

                var palette = JsonConvert.DeserializeObject<ColorPalette>(source.ToString());
                if (palette == null || palette.Colors.Count < 0)
                    return retval;

                var colors = new List<Color>();

                foreach (var color in palette.Colors) {
                    colors.Add(color);
                }

                retval.Name = palette.Name;
                retval.Alias = palette.Alias;
                retval.Colors = colors;

                return retval;
        }
开发者ID:bjarnef,项目名称:color-palettes,代码行数:35,代码来源:ColorPaletteEditorValueConverter.cs

示例10: ConvertDataToSource

 public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
 {
     // in xml a string is: string
     // in the database a string is: string
     // default value is: null
     return source;
 }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:7,代码来源:TextStringValueConverter.cs

示例11: ConvertDataToSource

        /// <summary>
        /// The convert data to source.
        /// </summary>
        /// <param name="propertyType">
        /// The property type.
        /// </param>
        /// <param name="source">
        /// The source.
        /// </param>
        /// <param name="preview">
        /// The preview.
        /// </param>
        /// <returns>
        /// The <see cref="object"/>.
        /// </returns>
        public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
        {
            var merchello = new MerchelloHelper();

            if (source == null)
                return null;

            var collectionKey = source.ToString();

            if (collectionKey.IsNullOrWhiteSpace())
            {

                var defaultCollection = merchello.Query.Product.Search(1, 10)
                    .Items.Select(x => merchello.TypedProductContent(((ProductDisplay)x).Key));

                return new ProductContentListView(Guid.Empty, defaultCollection);
            }

            try
            {
                var key = new Guid(collectionKey);
                return new ProductContentListView(key, merchello.TypedProductContentFromCollection(key));
            }
            catch (Exception ex)
            {
                MultiLogHelper.Error<ProductDisplayValueConverter>("Failed to Convert ProductDisplay property", ex);
                return null;
            }
        }
开发者ID:ryanology,项目名称:Merchello,代码行数:44,代码来源:ProductListViewValueConverter.cs

示例12: GetPropertyValueType

 public Type GetPropertyValueType(PublishedPropertyType propertyType)
 {
     if (IsMultipleDataType(propertyType.DataTypeId))
     {
         return !IsConverterDefault(propertyType) ? typeof(IEnumerable<Image>) : typeof(IEnumerable<IPublishedContent>);
     }
     return !IsConverterDefault(propertyType) ? typeof(Image) : typeof(IPublishedContent);
 }
开发者ID:ksolberg,项目名称:Hybrid-Framework-for-Umbraco-v7-Best-Practises,代码行数:8,代码来源:MultipleMediaPickerConverter.cs

示例13: ConvertDataToSource

 public object ConvertDataToSource(PublishedPropertyType propertyType, object data, bool preview) {
     switch (propertyType.PropertyEditorAlias) {
         case "Skybrud.SelfService.Categories":
             return SelfServiceContext.Current.Categories.GetCategoryByIds(data as string);
         default:
             return null;
     }
 }
开发者ID:abjerner,项目名称:Skybrud.Umbraco.SelfService,代码行数:8,代码来源:SelfServicePropertyValueConverter.cs

示例14: IsConverter

        /// <summary>
        /// Determines whether the specified property type is converter for Archetype.
        /// </summary>
        /// <param name="propertyType">Type of the property.</param>
        /// <returns></returns>
        public override bool IsConverter(PublishedPropertyType propertyType)
        {
            var isArcheTypePropertyEditor = !String.IsNullOrEmpty(propertyType.PropertyEditorAlias) 
                && propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditorAlias);
            if (!isArcheTypePropertyEditor)
                return false;

            return !ArchetypeHelper.Instance.IsPropertyValueConverterOverridden(propertyType.DataTypeId);
        }
开发者ID:madebysonder,项目名称:Archetype,代码行数:14,代码来源:ArchetypeValueConverter.cs

示例15: ConvertSourceToObject

        public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview)
        {
            if (source == null || UmbracoContext.Current == null)
            {
                return null;
            }

            return JsonConvert.DeserializeObject<PersonalisationGroupDefinition>(source.ToString());
        }
开发者ID:wderoo,项目名称:UmbracoPersonalisationGroups,代码行数:9,代码来源:PersonalisationGroupDefinitionPropertyValueConverter.cs


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