public void SetConfiguration(ImageProducerConfiguration config) { Action action = () => { while (_frameManager == null) { Thread.Sleep(10); } DoThingIfPresent <Dictionary <String, BitmapSource> >("setBackgroundImages", config, _frameManager.SetBackgroundImages); DoThingIfPresent <Dictionary <String, BitmapSource> >("addBackgroundImages", config, _frameManager.AddBackgroundImages); DoThingIfPresent <String> ("selectBackgroundImage", config, _frameManager.SelectBackgroundImage); DoThingIfPresent <float> ("depthThreshold", config, _frameManager.SetDepthThreshold); DoThingIfPresent <Object> ("captureHighQuality", config, _frameManager.CaptureHighQuality); }; if (_frameManager == null) { (new Thread(new ThreadStart(action))).Start(); } else { action.Invoke(); } }
private void DoThingIfPresent <T>(String key, ImageProducerConfiguration config, Action <T> action) { if (config.ContainsKey(key)) { Object value = config.Get(key); if (value is T) { action.BeginInvoke((T)value, null, null); } } }
public Tester() { BitmapImage backgroundImage = new BitmapImage(new Uri("pack://application:,,,/enterprise-D-bridge.bmp", UriKind.RelativeOrAbsolute)); backgroundImage.Freeze(); ImageProducerConfiguration config = ImageProducerConfiguration.Simple("backgroundImage", backgroundImage); //InitializeComponent(); _imageProducer = ImageProducerFactory.GetImageProducer(); _imageProducer.Start(); _imageProducer.SetConfiguration(config); _queue = _imageProducer.GetImageQueue(); _consumer = new Thread(new ThreadStart(Consume)); _consumer.Start(); this.Closing += Tester_Closing; }
public void SetConfiguration(ImageProducerConfiguration config) { // do nothing }