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


C# ITheme类代码示例

本文整理汇总了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;
        }
开发者ID:MattiasJakobsson,项目名称:Jajo.Cms,代码行数:29,代码来源:ContextParametersTextParser.cs

示例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);
        }
开发者ID:Rainking720,项目名称:MediaBrowser.Theater,代码行数:32,代码来源:ThemeManager.cs

示例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();
        }
开发者ID:MattiasJakobsson,项目名称:Jajo.Cms,代码行数:35,代码来源:TemplateTextParser.cs

示例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;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:35,代码来源:ThemeClassificationFormatDefinition.cs

示例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;
		}
开发者ID:BosslandGmbH,项目名称:Buddy.UI,代码行数:12,代码来源:Theme.cs

示例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);
        }
开发者ID:atitsbest,项目名称:llprk.net,代码行数:35,代码来源:ApplicationController.cs

示例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());
        }
开发者ID:MattiasJakobsson,项目名称:Jajo.Cms,代码行数:35,代码来源:ComponentTextParser.cs

示例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);
        }
开发者ID:MattiasJakobsson,项目名称:Jajo.Cms,代码行数:30,代码来源:LocalizationTextParser.cs

示例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);
        }
开发者ID:mofashi2011,项目名称:orchardcms,代码行数:8,代码来源:ThemeExtensions.cs

示例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);
 }
开发者ID:jcboliveira,项目名称:gps-running,代码行数:8,代码来源:UniqueRoutesSettingPageControl.cs

示例11: Load

 public CmsEndpointConfiguration Load(string endpoint, ITheme theme)
 {
     return new CmsEndpointConfiguration
     {
         Settings = new Dictionary<string, object>(),
         EndpointName = endpoint,
         Theme = theme.GetName()
     };
 }
开发者ID:MattiasJakobsson,项目名称:Jajo.Cms,代码行数:9,代码来源:FakeEndpointConfigurationStorage.cs

示例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);
        }
开发者ID:MattiasJakobsson,项目名称:Jajo.Cms,代码行数:9,代码来源:ComponentTextParserTests.cs

示例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;
        }
开发者ID:modulexcite,项目名称:NodePowerTools,代码行数:22,代码来源:OutputWindow.xaml.cs

示例14: AddTheme

 public bool AddTheme(ITheme theme)
 {
     if (!_themeDictionary.ContainsKey(theme.Name))
     {
         _themeDictionary.Add(theme.Name, theme);
         Themes.Add(theme);
         return true;
     }
     return false;
 }
开发者ID:OleksandrKulchytskyi,项目名称:MyFirstMEF,代码行数:10,代码来源:ThemeManager.cs

示例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;
 }
开发者ID:vinodj,项目名称:Wide,代码行数:11,代码来源:ThemeManager.cs


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