async void OnCalculateButtonClicked(object sender, EventArgs args) { // Configure the UI for a background process. calculateButton.IsEnabled = false; activityIndicator.IsRunning = true; // Render the Mandelbrot set on a bitmap. BmpMaker bmpMaker = new BmpMaker(pixelWidth, pixelHeight); await CalculateMandelbrotAsync(bmpMaker); image.Source = bmpMaker.Generate(); // Configure the UI for the completed background process. activityIndicator.IsRunning = false; }
public DiyGradientBitmapPage() { InitializeComponent(); int rows = 128; int cols = 64; BmpMaker bmpMaker = new BmpMaker(cols, rows); for (int row = 0; row < rows; row++) for (int col = 0; col < cols; col++) { bmpMaker.SetPixel(row, col, 2 * row, 0, 2 * (128 - row)); } ImageSource imageSource = bmpMaker.Generate(); image.Source = imageSource; }