public MainWindow() { InitializeComponent(); _buttonListener = new ButtonListener(ButtonPressHandler); // Setup key actions _keyActions.Add(Key.Left, NextBackgroundImage); _keyActions.Add(Key.Right, PrevBackgroundImage); _keyActions.Add(Key.Up, IncreaseDepthThreshold); _keyActions.Add(Key.Down, DecreaseDepthThreshold); _keyActions.Add(Key.Space, TakePicture); _keyActions.Add(Key.B, TakeBackgroundPicture); // Setup button actions _buttonActions.Add(0, TakePicture); // pin 2 _buttonActions.Add(1, NextBackgroundImage); // pin 3 _buttonActions.Add(2, PrevBackgroundImage); // pin 4 _buttonActions.Add(3, IncreaseDepthThreshold); // pin 5 _buttonActions.Add(4, DecreaseDepthThreshold); // pin 6 StartDialog startDialog = new StartDialog(); startDialog.ShowDialog(); _imageSavePath = startDialog.ImageSavePath; _printManager = PrintManager.GetInstance(startDialog.Name, startDialog.PrintCount); _printManager.SetPrintErrorInformer(HandlePrintError); _currentBatch = _printManager.startNewBatch(PrintTemplateType.Wide); _imageProducer = ImageProducerFactory.GetImageProducer(); _imageProducer.Start(); // Setup the background images _centerCarouselImageIndex = _carouselSize / 2; _carouselItemHeight = (double)_carouselWidth * (108.0f / 192.0f); LoadBackgroundImages(); SetBackgroundImage(); BuildCarousel(); _queue = _imageProducer.GetImageQueue(); _consumer = new Thread(new ThreadStart(Consume)); _consumer.Start(); UpdateStatus(); SetupStates(); }
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; }