我有两个几乎完全相同的课程。它们都产生视觉图表,实际上是相同的视觉图表。一个生成窗口图表,一个生成Web图表。类ChartFactoryA
使用
using System.Windows.Forms.DataVisualization.Charting;
ChartFactoryB
使用
using System.Web.UI.DataVisualization.Charting;
基本上两个图表采用相同的数据和构造,然后返回最终图表。我想在两个中创建一个类的方向,所以我可以将它移动到我的共享库。
这是班级
的公共和私人界面public class ChartFactory
{
private const int MAX_POINTS_DISPLAYED = 5;
private const int MAX_POINTS_TRACKED = 6;
public static Chart CreateChart(UserCourse userCourse)
private static Chart InitilizeChart()
private static Chart CreateEmptyChart()
private static ChartArea CreateEmptyChartArea()
private static void SetUpAxisY(ChartArea chartArea)
private static void SetUpAxisX(ChartArea chartArea)
private static Series CreateEmptyDataSeries()
private static void AttachStripLineToChart(ChartArea chartArea)
private static void PopulateChartWithData(Chart chart, UserCourse userCourse)
private static ChartPoint[] InitilizeChartPoints(SessionsReadOnly sessions, int pointCount)
private static void PopulateChartPointsWithSessions(SessionsReadOnly sessions, int pointCount, ChartPoint[] chartPoints)
private static void DisplayChartPointsInReverse(Chart chart, ChartPoint[] chartPoints)
}
答案 0 :(得分:0)
使用#define
示例(从Json.Net项目复制)
using System;
using System.Collections.Generic;
#if !SILVERLIGHT && !PocketPC && !NET20
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Web.Script.Serialization;
#endif
using System.Text;
using NUnit.Framework;
using Newtonsoft.Json;
using System.IO;
using System.Collections;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.ObjectModel;
using Newtonsoft.Json.Linq;
using System.Linq;
using Newtonsoft.Json.Converters;
#if !PocketPC && !NET20 && !WINDOWS_PHONE
using System.Runtime.Serialization.Json;
#endif
using Newtonsoft.Json.Tests.TestObjects;
using System.Runtime.Serialization;
using System.Globalization;
using Newtonsoft.Json.Utilities;
using System.Reflection;
#if !NET20 && !SILVERLIGHT
using System.Xml.Linq;
using System.Text.RegularExpressions;
using System.Collections.Specialized;
using System.Linq.Expressions;
#endif
#if !(NET35 || NET20 || WINDOWS_PHONE)
using System.Dynamic;
using System.ComponentModel;
#endif