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 GraphControlFormState(IGraphControlFormState state) { if (state == null) { throw new InvalidArgumentException("parameter is null"); } this.FitToScreenByX = state.FitToScreenByX; this.FitToScreenByY = state.FitToScreenByY; this.FitToScreenAlways = state.FitToScreenAlways; }
public GraphControlFormPresenter(IApplicationController controller, IGraphControlFormView view, IGraphControlFormState state, IGraphControlPresenter graphControlPresenter ) : base(controller, view) { this.state = state; this.View = view; // Store inner presenters this.graphControlPresenter = graphControlPresenter; UpdateState(); // Subsribe view events only after UpdateState() update initial state call! this.View.FitToScreenByX += View_FitToScreenByX; this.View.FitToScreenByY += View_FitToScreenByY; this.View.FitToScreenAlways += View_FitToScreenAlways; this.View.Load += View_Load; }
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); }
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); }
/// <summary> /// Called from parent presenter (GraphControlFormPresenter) to nofity about FitByX or FitByY was changed /// </summary> /// <param name="formState">updated state</param> public void UpdateFormState(IGraphControlFormState formState) { this.state = formState; UpdateView(true, null); // Update view FixByX or Y state was changed }