public void showImage(ConfigStatus.BckgrdSts backgroundLevel) { BitmapImage bitmapImage = new BitmapImage(); double level; switch (backgroundLevel) { case ConfigStatus.BckgrdSts.No: level = 0; break; case ConfigStatus.BckgrdSts.Level1: level = 0.9; break; case ConfigStatus.BckgrdSts.Level2: level = .96; break; default: level = 0; break; } Bitmap bmp = Generator(level); //bmp.MakeTransparent(System.Drawing.Color.White); //System.Drawing.Image img = (System.Drawing.Image)bmp; //Console.WriteLine(bmp.RawFormat.ToString()); using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) { bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); bitmapImage.BeginInit(); bitmapImage.StreamSource = ms; bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.EndInit(); bitmapImage.Freeze(); } Action workAction = delegate { img.Source = bitmapImage; }; mainWindow.Dispatcher.BeginInvoke(workAction, System.Windows.Threading.DispatcherPriority.Normal); Console.Write("GENERATED!"); }
public Configuration() { InitializeComponent(); this.visButtonGroup = new RadioButton[3]; this.visButtonGroup[0] = this._vis_0; this.visButtonGroup[1] = this._vis_1; this.visButtonGroup[2] = this._vis_2; backgroundButtonGroup = new RadioButton[3]; backgroundButtonGroup[0] = _complexity_0; backgroundButtonGroup[1] = _complexity_1; backgroundButtonGroup[2] = _complexity_2; this.config = new ConfigStatus(); }