Esempio n. 1
0
        private string GetColorFunction(
            TemplateColor tc
            )
        {
            string val = tc.BasedOn;

            if (!String.IsNullOrEmpty(tc.Effect))
            {
                val += (!String.IsNullOrEmpty(val) ? "-" : "") + tc.Effect;
            }

            return(val);
        }
Esempio n. 2
0
        private object ModifyLevel(
            object o,
            string func,
            int level
            )
        {
            TemplateColor tc    = null;
            object        value = null;
            string        modifier;

            string[] parameters = null;
            string[] sp;
            string   mod;

            if (level > MAX_LEVEL)
            {
                throw new InvalidOperationException("Max color dependency level reached");
            }

            if (o == null)
            {
                if (!func.Contains("-"))
                {
                    while (value == null)
                    {
                        tc  = g_templates[func];
                        mod = GetColorFunction(tc);

                        if (tc.Color != null)
                        {
                            if (!String.IsNullOrEmpty(mod))
                            {
                                value = Modify(tc.Color, mod, level);
                            }
                            else
                            {
                                value = tc.Color;
                            }
                        }
                        else if (!String.IsNullOrEmpty(mod))
                        {
                            value = At(mod);
                        }
                    }
                }
                else
                {
                    value = At(func);
                }
            }
            else
            {
                sp       = func.Split(new char[] { '(', ',', ')' });
                modifier = sp[0];

                var p = sp.ToList();
                p.RemoveAt(0);
                parameters = p.Where((s) => !String.IsNullOrEmpty(s)).ToArray();

                if (o as Color? != null)
                {
                    value = ModifyColor(o, modifier, parameters);
                }

                if (value == null)
                {
                    value = ModifyBrush(o, modifier, parameters, value as Color?);
                }
            }

            return(value);
        }
Esempio n. 3
0
 public static void AddTemplate(
     TemplateColor a
     )
 {
     g_templates[a.Name] = a;
 }