示例#1
0
        internal static string RenderReplacementSkinsForCollection(string skinCollection)
        {
            SkinAccess   skinAccess             = new SkinAccess();
            PageSkinList skinList               = skinAccess.GetAllPageSkins(skinCollection);
            List <SelectionItem <string> > list = (from skin in skinList orderby skin.Description select new SelectionItem <string>()
            {
                Text = skin.Name,
                Tooltip = skin.Description,
                Value = skin.PageViewName,
            }).ToList();

            // render a new dropdown list
            return(DropDownListEditComponentBase <string> .RenderDataSource(list, null));
        }
示例#2
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(string model)
        {
            // get all available page skins for this collection
            SkinAccess   skinAccess             = new SkinAccess();
            string       collection             = GetSiblingProperty <string>($"{PropertyName}_Collection");
            PageSkinList skinList               = skinAccess.GetAllPageSkins(collection);
            List <SelectionItem <string> > list = (from skin in skinList orderby skin.Description select new SelectionItem <string>()
            {
                Text = skin.Name,
                Tooltip = skin.Description,
                Value = skin.PageViewName,
            }).ToList();

            // display the skins in a drop down
            return(await DropDownListComponent.RenderDropDownListAsync(this, model, list, "yt_skinname"));
        }
示例#3
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public Task <string> RenderAsync(string model)
        {
            // get all available page skins for this collection
            SkinAccess   skinAccess = new SkinAccess();
            string       collection = GetSiblingProperty <string>($"{PropertyName}_Collection");
            PageSkinList skinList   = skinAccess.GetAllPageSkins(collection);

            string desc = (from skin in skinList where skin.PageViewName == model select skin.Name).FirstOrDefault();

            if (desc == null)
            {
                desc = skinList.First().Description;
            }
            if (string.IsNullOrWhiteSpace(desc))
            {
                return(Task.FromResult <string>(null));
            }
            return(Task.FromResult(HE(desc)));
        }