Example #1
0
 private void SetBarRendering(List <BarModel> bars)
 {
     if (_barType == BarType.Candle)
     {
         _barRendering = new BarCandle(_d2DRenderTarget, bars, _chart);
     }
     else
     {
         _barRendering = new BarOHLC(_d2DRenderTarget, bars, _chart);
     }
 }
Example #2
0
        private void KeyKeyboardChecker(Keys key)
        {
            switch (key)
            {
            case Keys.Escape:
            {
                _renderForm.Close();
                this.Hide();
                this.Close();
                break;
            }

            case Keys.D1:
            {
                if (_barType != BarType.Candle)
                {
                    _barType = BarType.Candle;

                    SetForChartMinMaxPoints(_barRendering.Skip);

                    _barRendering = new BarCandle(_d2DRenderTarget, _barRendering.Bars, _chart, _barRendering.Skip);
                    break;
                }
                break;
            }

            case Keys.D2:
            {
                if (_barType != BarType.OHLC)
                {
                    _barType = BarType.OHLC;

                    SetForChartMinMaxPoints(_barRendering.Skip);

                    _barRendering = new BarOHLC(_d2DRenderTarget, _barRendering.Bars, _chart, _barRendering.Skip);
                    break;
                }
                break;
            }

            case Keys.Q:
            {
                if (_chartHelpers != ChartHelpers.Net)
                {
                    _chartHelpers = ChartHelpers.Net;

                    _drawAdditionChartHelper = DrawNet;

                    break;
                }
                _drawAdditionChartHelper -= DrawNet;

                _chartHelpers = ChartHelpers.Default;
                break;
            }

            case Keys.W:
            {
                if (_chartHelpers != ChartHelpers.Lines)
                {
                    _chartHelpers = ChartHelpers.Lines;

                    _drawAdditionChartHelper = DrawLines;
                    break;
                }

                _drawAdditionChartHelper -= DrawLines;
                _chartHelpers             = ChartHelpers.Default;
                break;
            }

            case Keys.E:
            {
                if (_actions != DrawingActions.LineDrawing)
                {
                    _actions     = DrawingActions.LineDrawing;
                    _tempDrawing = new LineFigure(_d2DRenderTarget);
                    break;
                }

                _tempDrawing = null;
                _actions     = DrawingActions.Default;
                break;
            }

            case Keys.R:
            {
                if (_actions != DrawingActions.RectangleDrawing)
                {
                    _tempDrawing = new RectangleFigure(_d2DRenderTarget);
                    _actions     = DrawingActions.RectangleDrawing;
                    break;
                }

                _tempDrawing = null;
                _actions     = DrawingActions.Default;
                break;
            }

            case Keys.T:
            {
                if (_actions != DrawingActions.EllipseDrawing)
                {
                    _tempDrawing = new EllipseFigure(_d2DRenderTarget);
                    _actions     = DrawingActions.EllipseDrawing;
                    break;
                }

                _tempDrawing = null;
                _actions     = DrawingActions.Default;
                break;
            }

            case Keys.A:
            {
                if (_actions != DrawingActions.StraightLineXDrawing)
                {
                    _actions = DrawingActions.StraightLineXDrawing;
                    break;
                }

                _actions = DrawingActions.Default;
                break;
            }

            case Keys.S:
            {
                if (_actions != DrawingActions.StraightLineYDrawing)
                {
                    _actions = DrawingActions.StraightLineYDrawing;
                    break;
                }

                _actions = DrawingActions.Default;
                break;
            }

            case Keys.Z:
            {
                if (_chartHelpers != ChartHelpers.Zoom)
                {
                    _zoomArea     = null;
                    _chartHelpers = ChartHelpers.Zoom;
                    break;
                }

                _chartHelpers = ChartHelpers.Default;
                break;
            }

            case Keys.Delete:
            {
                RemoveFigure();
                break;
            }

            case Keys.C:
            {
                _chart.ChangeColor();
                break;
            }

            case Keys.Enter:
            {
                ResetChart();
                break;
            }
            }
        }