Пример #1
0
 /// <summary>
 /// Get widget template content
 /// </summary>
 /// <param name="widgetSetup"></param>
 /// <returns></returns>
 public static string GetTemplateStyle(WidgetSetupModel widgetSetup)
 {
     return
         (EmbeddedResourceHelper.GetNullableString(
              string.Format("{0}.{1}.{2}.Style.cshtml", DataSetupResourceType.WidgetTemplate.GetEnumName(),
                            widgetSetup.Widget, widgetSetup.DefaultTemplate), ResourceNamespace));
 }
Пример #2
0
 /// <summary>
 /// Get plugin widget template content
 /// </summary>
 /// <param name="widgetSetup"></param>
 /// <param name="pluginResourceNameSpace"></param>
 /// <returns></returns>
 public static string GetPluginTemplateScript(WidgetSetupModel widgetSetup, string pluginResourceNameSpace)
 {
     return
         (EmbeddedResourceHelper.GetNullableString(
              string.Format("{0}.{1}.{2}.Script.cshtml", DataSetupResourceType.WidgetTemplate.GetEnumName(),
                            widgetSetup.Widget, widgetSetup.DefaultTemplate), pluginResourceNameSpace));
 }
Пример #3
0
        /// <summary>
        /// Get plugin widget template content
        /// </summary>
        /// <param name="widgetSetup"></param>
        /// <param name="pluginResourceNameSpace"></param>
        /// <returns></returns>
        public static string GetPluginTemplateFullContent(WidgetSetupModel widgetSetup, string pluginResourceNameSpace)
        {
            var content = GetPluginTemplateContent(widgetSetup, pluginResourceNameSpace);
            var style   = GetPluginTemplateStyle(widgetSetup, pluginResourceNameSpace);
            var script  = GetPluginTemplateScript(widgetSetup, pluginResourceNameSpace);
            var widgets = GetPluginTemplateWidgets(widgetSetup, pluginResourceNameSpace);

            return(WidgetHelper.GetFullTemplate(content, style, script, widgetSetup.Type.AssemblyQualifiedName, widgets));
        }
Пример #4
0
 /// <summary>
 /// Get widget template widgets
 /// </summary>
 /// <param name="widgetSetup"></param>
 /// <returns></returns>
 public static string GetTemplateWidgets(WidgetSetupModel widgetSetup)
 {
     try
     {
         var folder  = string.Format("{0}.{1}.Widgets", DataSetupResourceType.WidgetTemplate.GetEnumName(), widgetSetup.Widget);
         var widgets = GetAllResourcesInFolder(folder).Select(r => new WidgetTemplate
         {
             Name    = r.Name.Replace(".cshtml", string.Empty),
             Content = r.Content
         }).ToList();
         return(SerializeUtilities.Serialize(widgets));
     }
     catch (ArgumentException)
     {
         // No folder
         return(string.Empty);
     }
 }