本文整理汇总了C#中ITheme类的典型用法代码示例。如果您正苦于以下问题:C# ITheme类的具体用法?C# ITheme怎么用?C# ITheme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITheme类属于命名空间,在下文中一共展示了ITheme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindParameterValue
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse)
{
var contextNameGroup = match.Groups["contextName"];
if (contextNameGroup == null || string.IsNullOrEmpty(contextNameGroup.Value))
return "";
var path = match.Groups["contextName"].Value;
var parts = path.Split('.');
var contextName = parts.FirstOrDefault();
var requestContext = context.FindContext(contextName);
if (requestContext == null)
return null;
var settingsName = parts.Skip(1).FirstOrDefault();
if (!requestContext.Data.ContainsKey(settingsName))
return null;
var value = _findParameterValueFromModel.Find(path.Substring(string.Format("{0}.{1}.", contextName, settingsName).Length), requestContext.Data[settingsName]);
var stringValue = value as string;
return stringValue != null ? recurse(stringValue) : value;
}
示例2: LoadTheme
public async Task LoadTheme(ITheme theme)
{
if (_currentTheme == theme)
{
return;
}
var hadThemePrior = false;
if (_currentTheme != null)
{
if (string.Equals(_currentTheme.Name, theme.Name))
{
return;
}
UnloadThemeInternal(_currentTheme);
hadThemePrior = true;
}
_logger.Info("Loading theme: {0}", theme.Name);
LoadThemeInternal(theme);
if (hadThemePrior)
{
// TODO: Figure out how to determine when this has completed
await Task.Delay(10);
}
EventHelper.FireEventIfNotNull(ThemeLoaded, this, new ItemEventArgs<ITheme> { Argument = theme }, _logger);
}
示例3: FindParameterValue
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse)
{
var templateNameGroup = match.Groups["templateName"];
if (templateNameGroup == null)
return "";
var templateName = templateNameGroup.Value;
var template = _templateStorage.Load(templateName, theme);
if (template == null)
return "";
var settings = new Dictionary<string, object>();
var settingsGroup = match.Groups["settings"];
if (settingsGroup != null && !string.IsNullOrEmpty(settingsGroup.Value))
{
var settingsJson = settingsGroup.Value;
if (!string.IsNullOrEmpty(settingsJson))
{
var parsedSettings = JsonConvert.DeserializeObject<IDictionary<string, object>>(settingsJson);
foreach (var item in parsedSettings)
settings[item.Key] = item.Value;
}
}
var renderResult = cmsRenderer.RenderTemplate(template, settings, context, theme);
return renderResult.Read();
}
示例4: CreateResourceDictionary
/// <summary>
/// Creates a new <see cref="ResourceDictionary"/>
/// </summary>
/// <param name="theme">Theme</param>
/// <returns></returns>
public ResourceDictionary CreateResourceDictionary(ITheme theme) {
if (theme == null)
throw new ArgumentNullException(nameof(theme));
var res = CreateResourceDictionary();
var isBold = GetIsBold(theme);
if (isBold != null)
res.Add(IsBoldId, isBold.Value);
var isItalic = GetIsItalic(theme);
if (isItalic != null)
res.Add(IsItalicId, isItalic.Value);
var fg = GetForeground(theme);
if (fg != null) {
res[ForegroundBrushId] = fg;
if (fg.Opacity != 1)
res[ForegroundOpacityId] = fg.Opacity;
}
var bg = GetBackground(theme);
if (bg != null) {
res[BackgroundBrushId] = bg;
if (bg.Opacity != 1)
res[BackgroundOpacityId] = bg.Opacity;
}
return res;
}
示例5: Equals
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">The other.</param>
/// <returns></returns>
public bool Equals(ITheme other)
{
if (other == null)
return false;
return Name == other.Name;
}
示例6: PrepareRenderTemplate
/// <summary>
/// Setup all necessary to later render the shop templates.
/// </summary>
/// <param name="theme"></param>
/// <param name="templateName"></param>
/// <param name="layout"></param>
/// <param name="template"></param>
public void PrepareRenderTemplate(ITheme theme, string templateName, out Template layout, out Template template)
{
IThemeItem layoutItem;
IThemeItem templateItem;
if (ViewBag.Unpublished != null)
{
layoutItem = theme.GetUnpublishedItem("layout.liquid", "layouts");
templateItem = theme.GetUnpublishedItem(templateName, "templates");
}
else
{
layoutItem = theme.GetItem("layout.liquid", "layouts");
templateItem = theme.GetItem(templateName, "templates");
}
Template.FileSystem = new Llprk.Web.UI.Areas.Store.Controllers.LiquidFileSystem(theme, ViewBag.Unpublished ?? false);
Template.RegisterFilter(typeof(ScriptTagFilter));
Template.RegisterFilter(typeof(StylesheetTagFilter));
Template.RegisterFilter(typeof(ImageUrlFilter));
// Template lesen. TODO: Cache.
layout = Template.Parse(layoutItem.ReadContent());
template = Template.Parse(templateItem.ReadContent());
// Render Template.
template.Registers.Add("file_system", Template.FileSystem);
}
示例7: FindParameterValue
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse)
{
var componentNameGroup = match.Groups["componentName"];
if (componentNameGroup == null)
return "";
var componentName = componentNameGroup.Value;
var component = context.Filter(_components.Where(x => x.GetType().Name == componentName), theme).FirstOrDefault();
if (component == null)
return "";
var settings = component.GetDefaultSettings();
var settingsGroup = match.Groups["settings"];
if (!string.IsNullOrEmpty(settingsGroup?.Value))
{
var settingsJson = settingsGroup.Value;
if (!string.IsNullOrEmpty(settingsJson))
{
var parsedSettings = JsonConvert.DeserializeObject<IDictionary<string, object>>(settingsJson);
foreach (var item in parsedSettings)
settings[item.Key] = item.Value;
}
}
var renderResult = cmsRenderer.RenderComponent(component, settings, context, theme);
return recurse(renderResult.Read());
}
示例8: FindParameterValue
protected override object FindParameterValue(Match match, ICmsRenderer cmsRenderer, ICmsContext context, ITheme theme, Func<string, string> recurse)
{
var localizationNamespace = _findCurrentLocalizationNamespace.Find();
var key = !string.IsNullOrEmpty(localizationNamespace) ? string.Format("{0}:{1}", localizationNamespace, match.Groups["resource"].Value) : match.Groups["resource"].Value;
var replacements = new Dictionary<string, string>();
var replacementsGroup = match.Groups["replacements"];
if (replacementsGroup != null && !string.IsNullOrEmpty(replacementsGroup.Value))
{
var replacementsData = replacementsGroup
.Value
.Split(',')
.Where(x => !string.IsNullOrEmpty(x))
.Select(x => x.Split(':'))
.Where(x => x.Length > 1 && !string.IsNullOrEmpty(x[0]) && !string.IsNullOrEmpty(x[1]))
.ToList();
foreach (var item in replacementsData)
replacements[item[0]] = item[1];
}
var localized = _localizeText.Localize(key, _findCultureForRequest.FindUiCulture());
localized = replacements.Aggregate(localized, (current, replacement) => current.Replace(string.Concat("{{", replacement.Key, "}}"), replacement.Value));
return recurse(localized);
}
示例9: ThemePath
public static string ThemePath(this HtmlHelper helper, ITheme theme, string path)
{
Control parent = helper.ViewDataContainer as Control;
Argument.ThrowIfNull(parent, "helper.ViewDataContainer");
return parent.ResolveUrl(helper.Resolve<IExtensionManager>().GetThemeLocation(theme) + path);
}
示例10: ThemeChanged
public void ThemeChanged(ZoneFiveSoftware.Common.Visuals.ITheme visualTheme)
{
m_visualTheme = visualTheme;
this.bandwidthBox.ThemeChanged(visualTheme);
this.ignoreBeginningBox.ThemeChanged(visualTheme);
this.ignoreEndBox.ThemeChanged(visualTheme);
this.boxCategory.ThemeChanged(visualTheme);
}
示例11: Load
public CmsEndpointConfiguration Load(string endpoint, ITheme theme)
{
return new CmsEndpointConfiguration
{
Settings = new Dictionary<string, object>(),
EndpointName = endpoint,
Theme = theme.GetName()
};
}
示例12: RenderComponent
public override IRenderResult RenderComponent(ICmsComponent component, IDictionary<string, object> settings, ICmsContext context, ITheme theme)
{
var result = component.Render(context, settings) as TextRenderInformation;
if(result == null)
return new RenderResult("", "");
return new RenderResult(result.ContentType, result.Text);
}
示例13: Initialize
//--------------------------------------------------------------------------
//
// Methods
//
//--------------------------------------------------------------------------
#region Initialize
/// <summary>
/// monitor the log file for changes, set up the initial read
/// </summary>
/// <param name="filePath"></param>
/// <param name="siteFileWatcherService"></param>
public void Initialize(string logDirectory, ISiteFileWatcherService siteFileWatcherService, ITheme theme)
{
_logDirectory = new DirectoryInfo(logDirectory);
_siteFileWatcherService = siteFileWatcherService;
_siteFileWatcherService.RegisterForSiteNotifications(WatcherChangeTypes.Created | WatcherChangeTypes.Changed, new FileSystemEventHandler(FileSystemEvent), null);
//outy.Foreground = theme.DefaultFormat.ForeColor;
//outy.Background = theme.DefaultFormat.BackColor;
}
示例14: AddTheme
public bool AddTheme(ITheme theme)
{
if (!_themeDictionary.ContainsKey(theme.Name))
{
_themeDictionary.Add(theme.Name, theme);
Themes.Add(theme);
return true;
}
return false;
}
示例15: AddTheme
public bool AddTheme(ITheme theme)
{
if (!ThemeDictionary.ContainsKey(theme.Name))
{
//theme.UriList.Add(new Uri("pack://application:,,,/Wide.Core;component/Styles/MenuResource.xaml"));
ThemeDictionary.Add(theme.Name, theme);
Themes.Add(theme);
return true;
}
return false;
}