src/ZKEACMS.TemplateImporter/Service/WdigetCreatorManager.cs

(完整代码) 1KB

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using Easy.RepositoryPattern;
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ZKEACMS.Common.Models;
using ZKEACMS.Theme;
using ZKEACMS.Widget;

namespace ZKEACMS.TemplateImporter.Service
{
    public class WdigetCreatorManager : IWdigetCreatorManager
    {
        private readonly IEnumerable<IWidgetCreatorService> _widgetCreators;
        public WdigetCreatorManager(IEnumerable<IWidgetCreatorService> widgetCreators)
        {
            _widgetCreators = widgetCreators;
        }

        public WidgetBase Create(string section, string themeName)
        {
            foreach (var item in _widgetCreators)
            {
                WidgetBase widget = item.Create(section, themeName);
                if (widget != null)
                {
                    return widget;
                }
            }
            return new HtmlWidget
            {
                AssemblyName = "ZKEACMS",
                PartialView = "Widget.HTML",
                ServiceTypeName = "ZKEACMS.Common.Service.HtmlWidgetService",
                ViewModelTypeName = "ZKEACMS.Common.Models.HtmlWidget",
                HTML = section
            };
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。