示例#1
0
        private static ThemeStyle ProcessStyle(string name, string content, StringDictionary variables, ContextDictionary context)
        {
            if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(content))
            {
                return(null);
            }

            StringDictionary values = new StringDictionary();

            content.ParseKeyValuePair((t1, t2) => values.Add(t1, t2));

            string             module       = null;
            ThemeParserContext styleContext = ThemeParserContext.Default;

            if (values.TryGetValue("$module", out module))
            {
                context.TryGetValue(module, out styleContext);
                values.Remove("$module");
            }

            ThemeStyle style = new ThemeStyle(styleContext, name);

            style.UpdateProperties(values);

            return(style);
        }
示例#2
0
        private static ThemeParserContext ParseContext(string content, ContextDictionary context)
        {
            if (string.IsNullOrWhiteSpace(content))
            {
                throw new InvalidOperationException("@modules section cannot be empty");
            }

            ThemeParserContext result = null;

            content.ParseKeyValuePair(
                (key, value) =>
            {
                try
                {
                    context.Add(key, new ThemeParserContext(Assembly.Load(value)));
                }
                catch
                {
                }
                //if (string.Compare(key, "Assembly", true) == 0)
                //{
                //    result = new ThemeParserContext(Assembly.Load(value));
                //}
            });
            return(result);
        }
示例#3
0
 public ThemeStyle(ThemeParserContext context, string className)
     : this(context)
 {
     Target = Context.GetTarget(className);
 }
示例#4
0
 public ThemeStyle(ThemeParserContext context)
 {
     Context    = context;
     Properties = new StringDictionary();
 }