using System; namespace DevComponents.DotNetBar.Charts.Style { /// /// Represents base class that each visual style factory for the ChartControl inherits from. /// public abstract class VisualStyleFactory { /// /// Create the DefaultVisualStyle for the ChartControl. /// /// Color-Factory used to generate colors. /// New instance of DefaultVisualStyles class. public abstract DefaultVisualStyles CreateStyle(Rendering.ColorFactory factory); /// /// Create the DefaultVisualStyle for the ChartControl with empty color factory. /// /// New instance of DefaultVisualStyles class. public virtual DefaultVisualStyles CreateStyle() { if (StyleManager.ColorTint.IsEmpty) return CreateStyle(Rendering.ColorFactory.Empty); return CreateStyle(new Rendering.ColorBlendFactory(StyleManager.ColorTint)); } /// /// Returns the style factory for specified visual style. /// /// Style to create factory for. /// An instance of VisualStyleFactory. public static VisualStyleFactory GetStyleFactory(ChartControlStyle style) { if (style == ChartControlStyle.Office2010Blue) return new Office2010BlueStyleFactory(); if (style == ChartControlStyle.Office2010Silver) return new Office2010SilverStyleFactory(); if (style == ChartControlStyle.Office2010Black) return new Office2010BlackStyleFactory(); if (style == ChartControlStyle.Metro) return new MetroStyleFactory(); throw new ArgumentException(string.Format( "Specified style '{0}' factory has not been implemented.", style)); } } }