public InvestmentForecastOrchestrator(IBoundsFactory boundsFactory, IForecastCalculator forecastCalculator, IValidationService validationService) { _boundsFactory = boundsFactory; _forecastCalculator = forecastCalculator; _validator = validationService; }
private IList <INative> ToNatives( INativeConverter nativeConverter, IBoundsFactory boundsFactory, ICanvas nativeCanvas, IList <INative> xchildren) { var natives = new List <INative>(); foreach (var child in xchildren) { if (child is IPin) { var native = nativeConverter.Convert(child as IPin); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is ILine) { var native = nativeConverter.Convert(child as ILine); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IBezier) { var native = nativeConverter.Convert(child as IBezier); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IQuadraticBezier) { var native = nativeConverter.Convert(child as IQuadraticBezier); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IArc) { var native = nativeConverter.Convert(child as IArc); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IRectangle) { var native = nativeConverter.Convert(child as IRectangle); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IEllipse) { var native = nativeConverter.Convert(child as IEllipse); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IText) { var native = nativeConverter.Convert(child as IText); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IBlock) { var native = nativeConverter.Convert(child as IBlock); natives.Add(native); var blockNatives = ToNatives( nativeConverter, boundsFactory, nativeCanvas, native.Children); } else { throw new NotSupportedException(); } } return(natives); }
public InvestmentForecastOrchestrator(IBoundsFactory boundsFactory, IForecastCalculator forecastCalculator) { _boundsFactory = boundsFactory; _forecastCalculator = forecastCalculator; }
private IList<INative> ToNatives( INativeConverter nativeConverter, IBoundsFactory boundsFactory, ICanvas nativeCanvas, IList<INative> xchildren) { var natives = new List<INative>(); foreach (var child in xchildren) { if (child is IPin) { var native = nativeConverter.Convert(child as IPin); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is ILine) { var native = nativeConverter.Convert(child as ILine); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IBezier) { var native = nativeConverter.Convert(child as IBezier); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IQuadraticBezier) { var native = nativeConverter.Convert(child as IQuadraticBezier); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IArc) { var native = nativeConverter.Convert(child as IArc); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IRectangle) { var native = nativeConverter.Convert(child as IRectangle); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IEllipse) { var native = nativeConverter.Convert(child as IEllipse); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IText) { var native = nativeConverter.Convert(child as IText); natives.Add(native); native.Bounds = boundsFactory.Create(nativeCanvas, native); if (native.Bounds != null) { native.Bounds.Update(); } } else if (child is IBlock) { var native = nativeConverter.Convert(child as IBlock); natives.Add(native); var blockNatives = ToNatives( nativeConverter, boundsFactory, nativeCanvas, native.Children); } else { throw new NotSupportedException(); } } return natives; }
public void Setup() { _boundsFactory = new BoundsFactory(); }
public XBezierEditor( INativeConverter nativeConverter, ICanvasFactory canvasFactory, IBoundsFactory boundsFactory, ICanvas canvas) { _canvas = canvas; Name = "Bézier"; Key = "B"; Modifiers = ""; var moves = _canvas.Moves.Where(_ => _canvas.IsCaptured); var drags = Observable.Merge(_canvas.Downs, _canvas.Ups, moves); _downs = _canvas.Downs.Where(_ => IsEnabled).Subscribe(p => { if (_canvas.IsCaptured) { switch (_state) { case State.Start: { //_xb.Point3.X = p.X; //_xb.Point3.Y = p.Y; //_nb.Point3 = _xb.Point3; //_xb.Point2.X = p.X; //_xb.Point2.Y = p.Y; //_nb.Point2 = _xb.Point2; #if CONNECTORS ConnectPoint3(p); #endif _nb.Bounds.Update(); _canvas.Render(null); _state = State.Point1; } break; case State.Point1: { //_xb.Point1.X = p.X; //_xb.Point1.Y = p.Y; //_nb.Point1 = _xb.Point1; #if CONNECTORS ConnectPoint1(p); #endif _nb.Bounds.Update(); _canvas.Render(null); _state = State.Point2; } break; case State.Point2: { //_xb.Point2.X = p.X; //_xb.Point2.Y = p.Y; //_nb.Point2 = _xb.Point2; #if CONNECTORS ConnectPoint2(p); #endif _nb.Bounds.Hide(); _canvas.Render(null); _state = State.None; _canvas.ReleaseCapture(); } break; } } else { _xb = canvasFactory.CreateBezier(); _xb.Start.X = p.X; _xb.Start.Y = p.Y; _xb.Point1.X = p.X; _xb.Point1.Y = p.Y; _xb.Point2.X = p.X; _xb.Point2.Y = p.Y; _xb.Point3.X = p.X; _xb.Point3.Y = p.Y; _nb = nativeConverter.Convert(_xb); _canvas.History.Snapshot(_canvas); #if CONNECTORS ConnectStart(p); #endif _canvas.Add(_nb); _nb.Bounds = boundsFactory.Create(_canvas, _nb); _nb.Bounds.Update(); _nb.Bounds.Show(); _canvas.Render(null); _canvas.Capture(); _state = State.Start; } }); _drags = drags.Where(_ => IsEnabled).Subscribe(p => { switch (_state) { case State.Start: { _xb.Point3.X = p.X; _xb.Point3.Y = p.Y; _nb.Point3 = _xb.Point3; _xb.Point2.X = p.X; _xb.Point2.Y = p.Y; _nb.Point2 = _xb.Point2; _nb.Bounds.Update(); _canvas.Render(null); } break; case State.Point1: { _xb.Point1.X = p.X; _xb.Point1.Y = p.Y; _nb.Point1 = _xb.Point1; _nb.Bounds.Update(); _canvas.Render(null); } break; case State.Point2: { _xb.Point2.X = p.X; _xb.Point2.Y = p.Y; _nb.Point2 = _xb.Point2; _nb.Bounds.Update(); _canvas.Render(null); } break; } }); }
public XLineEditor( INativeConverter nativeConverter, ICanvasFactory canvasFactory, IBoundsFactory boundsFactory, ICanvas canvas) { _canvas = canvas; Name = "Line"; Key = "L"; Modifiers = ""; var moves = _canvas.Moves.Where(_ => _canvas.IsCaptured); var drags = Observable.Merge(_canvas.Downs, _canvas.Ups, moves); _downs = _canvas.Downs.Where(_ => IsEnabled).Subscribe(p => { if (_canvas.IsCaptured) { //_xline.Point2.X = p.X; //_xline.Point2.Y = p.Y; //_nline.Point2 = _xline.Point2; #if CONNECTORS ConnectPoint2(p); #endif _nline.Bounds.Hide(); _canvas.Render(null); _state = State.None; _canvas.ReleaseCapture(); } else { _xline = canvasFactory.CreateLine(); _xline.Point1.X = p.X; _xline.Point1.Y = p.Y; _xline.Point2.X = p.X; _xline.Point2.Y = p.Y; _nline = nativeConverter.Convert(_xline); _canvas.History.Snapshot(_canvas); #if CONNECTORS ConnectPoint1(p); #endif _canvas.Add(_nline); _nline.Bounds = boundsFactory.Create(_canvas, _nline); _nline.Bounds.Update(); _nline.Bounds.Show(); _canvas.Capture(); _canvas.Render(null); _state = State.End; } }); _drags = drags.Where(_ => IsEnabled).Subscribe(p => { if (_state == State.End) { _xline.Point2.X = p.X; _xline.Point2.Y = p.Y; _nline.Point2 = _xline.Point2; _nline.Bounds.Update(); _canvas.Render(null); } }); }
public XPinEditor( INativeConverter nativeConverter, ICanvasFactory canvasFactory, IBoundsFactory boundsFactory, ICanvas canvas) { _canvas = canvas; Name = "Pin"; Key = "P"; Modifiers = ""; var moves = _canvas.Moves.Where(_ => _canvas.IsCaptured); var drags = Observable.Merge(_canvas.Downs, _canvas.Ups, moves); _downs = _canvas.Downs.Where(_ => IsEnabled).Subscribe(p => { _xpin = canvasFactory.CreatePin(); _xpin.Point.X = p.X; _xpin.Point.Y = p.Y; _npin = nativeConverter.Convert(_xpin); _canvas.History.Snapshot(_canvas); #if CONNECTORS ConnectPoint(p); #endif _canvas.Add(_npin); _npin.Bounds = boundsFactory.Create(_canvas, _npin); _npin.Bounds.Update(); _canvas.Render(null); }); }
public XMultiEditor( INativeConverter nativeConverter, ICanvasFactory canvasFactory, IBoundsFactory boundsFactory, ICanvas canvas) { _nativeConverter = nativeConverter; _canvasFactory = canvasFactory; _boundsFactory = boundsFactory; _canvas = canvas; Name = "Multi Selection"; Key = "J"; Modifiers = ""; var drags = Observable.Merge(_canvas.Downs, _canvas.Ups, _canvas.Moves); _downs = _canvas.Downs.Where(_ => IsEnabled).Subscribe(p => Down(p)); _ups = _canvas.Ups.Where(_ => IsEnabled).Subscribe(p => Up(p)); _drag = drags.Where(_ => IsEnabled).Subscribe(p => Drag(p)); }