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 static void CreateServiceInstances(IApplicationController applicationController, IMargin margin, IScaleState scaleState, out IDataService dataService, out IScaleService scaleService, out IBufferedDrawingService bufferedDrawingService) { dataService = new DataService(); applicationController.RegisterInstance <IDataService>(dataService); scaleService = new ScaleService(scaleState, dataService, margin); applicationController.RegisterInstance <IScaleService>(scaleService); bufferedDrawingService = new BufferedDrawingService(); applicationController.RegisterInstance <IBufferedDrawingService>(bufferedDrawingService); }
private static void CreatePresenterInstances(IApplicationController applicationController, IGraphControlFormView formView, IGraphControlView controlView, IScalingSelectionView scalingView, IGraphControlFormState graphControlFormState, IScalingState scalingState, IDataService dataService, IScaleService scaleService, IBufferedDrawingService bufferedDrawingService, IBackgroundPresenter backgroundPresenter, IGridPresenter gridPresenter, IDataPresenter dataPresenter) { var scalingPresenter = new ScalingSelectionPresenter(scalingView, scalingState, controlView, scaleService); applicationController.RegisterInstance <IScalingSelectionPresenter>(scalingPresenter); var graphControlPresenter = new GraphControlPresenter(applicationController, controlView, dataService, scaleService, bufferedDrawingService, backgroundPresenter, gridPresenter, dataPresenter, scalingPresenter ); applicationController.RegisterInstance <IGraphControlPresenter>(graphControlPresenter); var graphControlFormPresenter = new GraphControlFormPresenter( applicationController, formView, graphControlFormState, graphControlPresenter ); applicationController.RegisterInstance <GraphControlFormPresenter>(graphControlFormPresenter); }
public GraphControlPresenter(IApplicationController controller, IGraphControlView view, IDataService dataService, IScaleService scaleService, IBufferedDrawingService bufferedDrawingService, IBackgroundPresenter backgroundPresenter, IGridPresenter gridPresenter, IDataPresenter dataPresenter, IScalingSelectionPresenter scalingSelectionPresenter) : base(controller, view) { if (dataService == null) { throw new InvalidArgumentException("data sevice is null"); } this.scaleService = scaleService; this.backgroundPresenter = backgroundPresenter; this.gridPresenter = gridPresenter; this.dataPresenter = dataPresenter; this.scalingSelectionPresenter = scalingSelectionPresenter; dataService.DataUpdated += GraphControlPresenter_DataUpdated; this.View.DrawGraph += View_DrawGraph; this.View.ControlSizeChanged += View_ControlSizeChanged; this.View.MouseDown += this.scalingSelectionPresenter.MouseDown; this.View.MouseMove += this.scalingSelectionPresenter.MouseMove; this.View.MouseUp += this.scalingSelectionPresenter.MouseUp; this.View.MouseWheel += this.scalingSelectionPresenter.MouseWheel; if (bufferedDrawingService == null) { throw new InvalidArgumentException("parameter is null"); } this.bufferedDrawingService = bufferedDrawingService; this.bufferedDrawingService.UpdateScale += BufferedDrawingService_UpdateScale; this.bufferedDrawingService.DrawGraph += BufferedDrawingService_DrawGraph; this.bufferedDrawingService.SetImage += BufferedDrawingService_SetImage; }
public static IDataView Create(IApplicationController applicationController, IDataProviderService provider, IBufferedDrawingService bufferedDrawingService) { TestFactory.CreateBaseServices(applicationController, provider, out IGridState gridState, out IDataDrawState graphState, out IItemFormatter itemFormatter, out IMargin margin, out IDataService dataService, out IScaleService scaleService, ref bufferedDrawingService); return(new DataView(scaleService, dataService)); }
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); } }