コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
 public GameOfLife(List <Point> seedData, IGridPresenter gridPresenter)
 {
     _seedData      = seedData;
     _gridPresenter = gridPresenter;
 }