Exemple #1
0
        public static StiBrush LoadFromJson(JObject jObject)
        {
            var ident = jObject.Properties().FirstOrDefault(x => x.Name == "Ident");

            switch (ident.Value.ToObject <string>())
            {
            case "StiEmptyBrush":
                return(new StiEmptyBrush());

            case "StiSolidBrush":
                var solid = new StiSolidBrush();
                solid.LoadValuesFromJson(jObject);
                return(solid);

            case "StiGradientBrush":
                var gradient = new StiGradientBrush();
                gradient.LoadValuesFromJson(jObject);
                return(gradient);

            case "StiGlareBrush":
                var glare = new StiGlareBrush();
                glare.LoadValuesFromJson(jObject);
                return(glare);

            case "StiGlassBrush":
                var glass = new StiGlassBrush();
                glass.LoadValuesFromJson(jObject);
                return(glass);

            case "StiHatchBrush":
                var hatch = new StiHatchBrush();
                hatch.LoadValuesFromJson(jObject);
                return(hatch);
            }

            throw new Exception("Type is not supported!");
        }
 protected bool Equals(StiSolidBrush other)
 {
     return(color.Equals(other.color));
 }