Example #1
0
        public static AlephTheme GetFallback()
        {
            var t = new AlephTheme("DEFAULT_THEME_FALLBACK", new Version(0, 0, 0, 0), CompatibilityVersionRange.ANY, "NULL", "<!-- fallback -->", "auto generated", AlephThemeType.Fallback);

            var r = new Random();

            foreach (var propdef in AlephTheme.THEME_PROPERTIES)
            {
                switch (propdef.Item2)
                {
                case AlephTheme.AlephThemePropType.Color:
                    t.AddProperty(propdef.Item1, new AlephThemePropertyValue {
                        IsIndirect = false, DirectValue = ColorRef.GetRandom(r), XmlDirectValue = "random", IndirectionTarget = null
                    });
                    break;

                case AlephTheme.AlephThemePropType.Brush:
                    t.AddProperty(propdef.Item1, new AlephThemePropertyValue {
                        IsIndirect = false, DirectValue = BrushRef.CreateSolid(ColorRef.GetRandom(r)), XmlDirectValue = "random", IndirectionTarget = null
                    });
                    break;

                case AlephTheme.AlephThemePropType.Thickness:
                    t.AddProperty(propdef.Item1, new AlephThemePropertyValue {
                        IsIndirect = false, DirectValue = ThicknessRef.Create(r.Next(16), r.Next(16), r.Next(16), r.Next(16)), XmlDirectValue = "random", IndirectionTarget = null
                    });
                    break;

                case AlephTheme.AlephThemePropType.Integer:
                    t.AddProperty(propdef.Item1, new AlephThemePropertyValue {
                        IsIndirect = false, DirectValue = r.Next(16), XmlDirectValue = "random", IndirectionTarget = null
                    });
                    break;

                case AlephTheme.AlephThemePropType.Double:
                    t.AddProperty(propdef.Item1, new AlephThemePropertyValue {
                        IsIndirect = false, DirectValue = r.NextDouble() * 16, XmlDirectValue = "random", IndirectionTarget = null
                    });
                    break;

                case AlephTheme.AlephThemePropType.Boolean:
                    t.AddProperty(propdef.Item1, new AlephThemePropertyValue {
                        IsIndirect = false, DirectValue = (r.Next() % 2 == 0), XmlDirectValue = "random", IndirectionTarget = null
                    });
                    break;

                case AlephTheme.AlephThemePropType.CornerRadius:
                    t.AddProperty(propdef.Item1, new AlephThemePropertyValue {
                        IsIndirect = false, DirectValue = CornerRadiusRef.Create(r.Next(6)), XmlDirectValue = "random", IndirectionTarget = null
                    });
                    break;

                default:
                    throw new NotSupportedException();
                }
            }

            return(t);
        }
Example #2
0
        public static AlephTheme GetFallback()
        {
            var t = new AlephTheme("DEFAULT_THEME_FALLBACK", new Version(0, 0, 0, 0), CompatibilityVersionRange.ANY, "NULL", "<!-- fallback -->", true);

            var r = new Random();

            foreach (var propdef in AlephTheme.THEME_PROPERTIES)
            {
                switch (propdef.Item2)
                {
                case AlephTheme.AlephThemePropType.Color:
                    t.AddProperty(propdef.Item1, ColorRef.GetRandom(r));
                    break;

                case AlephTheme.AlephThemePropType.Brush:
                    t.AddProperty(propdef.Item1, BrushRef.CreateSolid(ColorRef.GetRandom(r)));
                    break;

                case AlephTheme.AlephThemePropType.Thickness:
                    t.AddProperty(propdef.Item1, ThicknessRef.Create(r.Next(16), r.Next(16), r.Next(16), r.Next(16)));
                    break;

                case AlephTheme.AlephThemePropType.Integer:
                    t.AddProperty(propdef.Item1, r.Next(16));
                    break;

                case AlephTheme.AlephThemePropType.Double:
                    t.AddProperty(propdef.Item1, r.NextDouble() * 16);
                    break;

                case AlephTheme.AlephThemePropType.Boolean:
                    t.AddProperty(propdef.Item1, r.Next() % 2 == 0);
                    break;

                case AlephTheme.AlephThemePropType.CornerRadius:
                    t.AddProperty(propdef.Item1, CornerRadiusRef.Create(r.Next(6)));
                    break;

                default:
                    throw new NotSupportedException();
                }
            }

            return(t);
        }