public MainWindow() { InitializeComponent(); _bmpLock = new object(); _previewMandelbrot = new Mandelbrot("Preview", _previewMaxIt, _centerX, _centerY, _complexZoom, _previewResultX, _previewResultY, _previewMaxTileSize); _previewMandelbrot.NewTileAvailable += RefreshImage; _renderMandelbrot = new Mandelbrot("Render", _renderMaxIt, _centerX, _centerY, _complexZoom, _renderResultX, _renderResultY, _renderMaxTileSize); _renderMandelbrot.NewTileAvailable += RefreshImage; _timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(200) }; _timer.Tick += StopTyping; _timer.IsEnabled = true; RegisterColorMappers(); comboBox.ItemsSource = _colorMappers.Keys; _initialized = true; Preview(); }
/// <summary> /// A Lambda function to respond to HTTP Get methods from API Gateway /// </summary> /// <param name="request"></param> /// <returns>The list of blogs</returns> public APIGatewayProxyResponse Get(APIGatewayProxyRequest request, ILambdaContext context) { context.Logger.LogLine("Get Request\n"); var iterations = Convert.ToInt32(request.QueryStringParameters["iterations"]); var bottomLeftX = Convert.ToDouble(request.QueryStringParameters["bottomleftx"]); var bottomLeftY = Convert.ToDouble(request.QueryStringParameters["bottomlefty"]); var topRightX = Convert.ToDouble(request.QueryStringParameters["toprightx"]); var topRightY = Convert.ToDouble(request.QueryStringParameters["toprighty"]); var stepX = Convert.ToInt32(request.QueryStringParameters["stepx"]); var stepY = Convert.ToInt32(request.QueryStringParameters["stepy"]); var result = Mandelbrot.CalculateArea( iterations, bottomLeftX, bottomLeftY, topRightX, topRightY, stepX, stepY); var response = new APIGatewayProxyResponse { StatusCode = 200, Body = $"{result.ToJsonMatrix()}", Headers = new Dictionary <string, string> { { "Content-Type", "application/json" } } }; return(response); }