示例#1
0
        private async void GenerateFractal(object sender, EventArgs e)
        {
            Task <FractalCreator> lFractalTask = new Task <FractalCreator>(AsyncAwaitMethod);

            lFractalTask.Start();
            FractalCreator l = await lFractalTask;

            pictureBox1.Size  = mSize;
            pictureBox1.Image = l.MBitmap;
        }
示例#2
0
        public FractalCreator AsyncAwaitMethod()
        {
            FractalCreator lfrac = new FractalCreator(mSize.Width, mSize.Height, mNbIterations);

            lfrac.RaiseProgressEvent += HandleProgressEvent;
            lfrac.addColorRange(0.0, 0.10, Color.FromArgb(0, 0, 254));
            lfrac.addColorRange(0.10, 0.25, Color.FromArgb(0, 128, 255));
            lfrac.addColorRange(0.25, 0.75, Color.FromArgb(0, 255, 255));
            lfrac.addColorRange(0.75, 1.0, Color.FromArgb(255, 255, 255));
            //lfrac.addZoom(new Zoom(295, 600 - 202, 0.1));
            //lfrac.addZoom(new Zoom(288, 600 - 304, 0.01));

            var progressIndicator = new Progress <int>(ReportProgress);

            lfrac.run("Test.bmp", progressIndicator);

            return(lfrac);
        }