private void Start() { _continue = true; Task.Factory.StartNew(() => { while (_continue) { Dispatcher.BeginInvoke(new Action(() => { try { _time.Text = time.ToString(); if (bkg == null) { _image.Source = firemap.ToByteArrayBitmap().ToBitmapSource(); } else { ByteArrayBitmap b = bkg.Clone(); firemap.PaintFire(b); _image.Source = b.ToBitmapSource(); } } catch (Exception ee) { } })); firemap.Update(); time = time.AddHours(6); Thread.Sleep(150); } }); }
private void _GenerateRandomDatat(object sender, RoutedEventArgs e) { firemap = new FireMap(200, 200, true); _image.Source = firemap.ToByteArrayBitmap().ToBitmapSource(); //Start(); }