public static void Main(string[] args) { IChartable chart = ChartFactory.GetChart("pie"); chart.Display(); Console.ReadKey(); }
public static IChartable GetChart(string type) { IChartable chartable = null; if (!string.IsNullOrEmpty(type)) { if (type.Equals("histogram", StringComparison.OrdinalIgnoreCase)) { chartable = new HistogramChart(); Console.WriteLine("初始化设置柱状图..."); } else if (type.Equals("pie", StringComparison.OrdinalIgnoreCase)) { chartable = new PieChart(); Console.WriteLine("初始化设置饼状图..."); } else if (type.Equals("line", StringComparison.OrdinalIgnoreCase)) { chartable = new LineChart(); Console.WriteLine("初始化设置折线图..."); } } return(chartable); }
/// <summary> /// Смена текущей сущности на другую /// </summary> /// <param name="chartable">Chartable таблица</param> /// <param name="elementsName">Название сущности</param> private void ChangeEntity(IChartable<RepositoryElement> chartable, string elementsName) { Paginator.CurrentPage = 1; Paginator.RegisterPaginable(chartable); Paginator.ElementsName = elementsName; this.SearchHintString = $"Поиск {elementsName.ToLower()}"; this.EntityGrid = chartable; }
public static IChartable GetChart(string type) { IChartable chart = null; if (type.Equals("histogram", StringComparison.OrdinalIgnoreCase)) { chart = new HistogramChart(); Console.WriteLine("初始化设置柱状图..."); } return(chart); }
public static void ClientV1() { IChartable chart = ChartFactory.GetChart("histogram"); if (chart != null) { chart.Display(); } chart = ChartFactory.GetChart("pie"); if (chart != null) { chart.Display(); } }
// 主函数,我想干啥直接搞接口就行了 static void Main(string[] args) { IChartable chart = ChartFactory.GetChart("histogram"); if (chart != null) { chart.Display(); } chart = ChartFactory.GetChart("pie"); if (chart != null) { chart.Display(); } }
public static void ClientV2() { string type = AppConfigHelper.GetChartType(); if (string.IsNullOrEmpty(type)) { return; } IChartable chart = ChartFactory.GetChart(type); if (chart != null) { chart.Display(); } }
public static void Main() { IChartable chart = ChartFactory.GetChart("histogram"); if (chart != null) { chart.Display(); } chart = ChartFactory.GetChart("pie"); if (chart != null) { chart.Display(); } Console.ReadKey(); }
static void Main(string[] args) { var chartType = GetConfiguration("charttype"); if (string.IsNullOrEmpty(chartType)) { return; } IChartable chart = ChartFactory.GetChart(chartType); if (chart != null) { chart.Display(); } Console.ReadLine(); }
static void Main(string[] args) { //可以从读取配置文件来获取要创建的图表 string chartType = ConfigurationManager.AppSettings["chartType"].ToString(); if (string.IsNullOrEmpty(chartType)) { return; } //核心逻辑是 在工厂类中实现创建产品的功能 IChartable chart = ChartFactory.GetChart(chartType); if (chart != null) { chart.Display(); } Console.ReadKey(); }
/* * 简单工厂 * 一个工厂 依赖抽象产品 * 抽象产品 * 具体产品 实现抽象产品 */ static void Main(string[] args) { Console.WriteLine("Hello World!"); IChartable chart = ChartFactory.GetChart("histogram"); if (chart != null) { chart.Display(); } Console.WriteLine(); chart = ChartFactory.GetChart("pie"); if (chart != null) { chart.Display(); } Console.ReadKey(); }
public projectChart(IChartable[] projectTasks) { _chartEntities = projectTasks; jsOutput = new StringBuilder(); }