public static void CreateBaseServices(IApplicationController applicationController, IDataProviderService provider, out IGridState gridState, out IDataDrawState graphState, out IItemFormatter itemFormatter, out IMargin margin, out IDataService dataService, out IScaleService scaleService, ref IBufferedDrawingService bufferedDrawingService) { var formView = new TestGraphControlFormView(); margin = formView.GraphMargin; itemFormatter = formView.ItemFormatter; var labelMargin = formView.LabelMargin; // Set property and Reset() formView.LabelMargin = labelMargin; formView.Reset(); TestFactory.CreateStateInstancees(applicationController, out IBackgroundState backgroundState, out gridState, out IScaleState scaleState, out graphState, out IGraphControlFormState graphControlFormState); TestFactory.CreateServiceInstances(applicationController, margin, scaleState, out dataService, out scaleService, ref bufferedDrawingService); if (provider != null) { dataService.RegisterDataProvider(provider); } }
private static void CreateStateInstances(IApplicationController applicationController, IItemFormatter itemFormatter, IMargin labelMargin, out IBackgroundState backgroundState, out IGridState gridState, out IScaleState scaleState, out IDataDrawState graphState, out IScalingState scalingState, out IGraphControlFormState graphControlFormState) { backgroundState = new BackgroundState(); applicationController.RegisterInstance <IBackgroundState>(backgroundState); gridState = new GridState(); gridState.LabelPadding = labelMargin; gridState.ItemFormatter = itemFormatter; applicationController.RegisterInstance <IGridState>(gridState); scaleState = new ScaleState(); applicationController.RegisterInstance <IScaleState>(scaleState); graphState = new DataDrawState(); applicationController.RegisterInstance <IDataDrawState>(graphState); scalingState = new ScalingState(); applicationController.RegisterInstance <IScalingState>(scalingState); graphControlFormState = new GraphControlFormState(); applicationController.RegisterInstance <IGraphControlFormState>(graphControlFormState); }
public static void CreateBaseServices(IApplicationController applicationController, IDataProviderService provider, out IGridState gridState, out IDataDrawState graphState, out IItemFormatter itemFormatter, out IMargin margin, out IDataService dataService, out IScaleService scaleService) { applicationController = applicationController ?? GraphControlFactory.CreateController(); IBufferedDrawingService bufferedDrawingService = null; TestFactory.CreateBaseServices(applicationController, provider, out gridState, out graphState, out itemFormatter, out margin, out dataService, out scaleService, ref bufferedDrawingService); }
private void DrawAllData(IDataDrawState state, IDrawing drawing, IMargin margin, Size canvasSize, System.Drawing.RectangleF clip) { var startX = this.scaleService.State.X1; var endX = this.scaleService.State.X2; if (this.dataService.ItemCount == 1) { // Draw point for single data item foreach (var item in this.dataService.GetItems(startX, endX)) { if (item != null && this.scaleService.IsItemVisible(item)) { var x = this.scaleService.ToScreen(Axis.X, item.X); var y = this.scaleService.ToScreen(Axis.Y, item.Y); drawing.Circle(state.LineColor, margin.Left + x, canvasSize.Height - margin.Bottom - y, 4, clip); } } } else { IDataItem prevItem = null; // Draw lines foreach (var item in this.dataService.GetItems(startX, endX)) { if (item != null && prevItem != null && (this.scaleService.IsItemVisible(prevItem) || this.scaleService.IsItemVisible(item))) { var x1 = this.scaleService.ToScreen(Axis.X, prevItem.X); var y1 = this.scaleService.ToScreen(Axis.Y, prevItem.Y); var x2 = this.scaleService.ToScreen(Axis.X, item.X); var y2 = this.scaleService.ToScreen(Axis.Y, item.Y); drawing.Line(state.LineColor, margin.Left + x1, canvasSize.Height - margin.Bottom - y1, margin.Left + x2, canvasSize.Height - margin.Bottom - y2, clip); } prevItem = item; } } }
private static void CreateViewInstances(IApplicationController applicationController, IGraphControlView controlView, IDataService dataService, IScaleService scaleService, IBackgroundView userBackgroundView, IGridView userGridView, IDataView userDataView, IScalingSelectionView userScalingSelectionView, IBackgroundState userBackgroundState, IGridState userGridState, IDataDrawState userDataDrawState, out IBackgroundPresenter backgroundPresenter, out IGridPresenter gridPresenter, out IDataPresenter dataPresenter, out IScalingSelectionView scalingView) { var backgroundView = userBackgroundView ?? new BackgroundView(); backgroundPresenter = new BackgroundPresenter(backgroundView, userBackgroundState); applicationController.RegisterInstance <IBackgroundPresenter>(backgroundPresenter); var gridView = userGridView ?? new GridView(scaleService); gridPresenter = new GridPresenter(gridView, userGridState); applicationController.RegisterInstance <IGridPresenter>(gridPresenter); var dataView = userDataView ?? new DataView(scaleService, dataService); dataPresenter = new DataPresenter(dataView, userDataDrawState, dataService); applicationController.RegisterInstance <IDataPresenter>(dataPresenter); scalingView = userScalingSelectionView ?? new ScalingView(); // Register IGraphControlView here applicationController.RegisterInstance <IGraphControlView>(controlView); }
public DataPresenter(IDataView dataView, IDataDrawState state, IDataService dataService) { this.view = dataView; this.state = state; this.dataService = dataService; }
private static void CreateStateInstancees(IApplicationController applicationController, out IBackgroundState backgroundState, out IGridState gridState, out IScaleState scaleState, out IDataDrawState graphState, out IGraphControlFormState graphControlFormState) { backgroundState = new BackgroundState(); applicationController.RegisterInstance <IBackgroundState>(backgroundState); gridState = new GridState(); applicationController.RegisterInstance <IGridState>(gridState); scaleState = new ScaleState(); applicationController.RegisterInstance <IScaleState>(scaleState); graphState = new DataDrawState(); applicationController.RegisterInstance <IDataDrawState>(graphState); graphControlFormState = new GraphControlFormState(); applicationController.RegisterInstance <IGraphControlFormState>(graphControlFormState); }
public static void CreateBaseServices(int testPointNumber, out IGridState gridState, out IDataDrawState graphState, out IDataService dataService, out IScaleService scaleService) { var provider = TestSinusDataProviderService.Create(testPointNumber); TestFactory.CreateBaseServices(null, provider, out gridState, out graphState, out IItemFormatter itemFormatter, out IMargin margin, out dataService, out scaleService); provider.Run(); }