Exemple #1
0
        public void Open()
        {
            _error = false;

            Show();

            TextBeforeVideo.Visibility = Visibility.Hidden;
            EndMessage.Visibility      = Visibility.Hidden;
            ErrorMessage.Visibility    = Visibility.Hidden;
            Video.Visibility           = Visibility.Hidden;
            ButtonImageStop.Visibility = Visibility.Hidden;
            ButtonImage5.Visibility    = Visibility.Hidden;
            ButtonImage4.Visibility    = Visibility.Hidden;
            ButtonImage3.Visibility    = Visibility.Hidden;
            ButtonImage2.Visibility    = Visibility.Hidden;
            ButtonImage1.Visibility    = Visibility.Hidden;
            ButtonImage0.Visibility    = Visibility.Hidden;
            StopButton.Visibility      = Visibility.Hidden;
            StopButton.IsEnabled       = false;

            _liveView = new LiveView(_cameraDevice, StopWithEndMessage);
            _liveView.Start(Video, false);

            LaunchTimerBeforeCapture(3);
        }
        private void StopWithErrorMessage()
        {
            _error = true;
            GridPhoto.Dispatcher.Invoke(() => VisibilityManagement(-1));

            if (_liveView != null)
            {
                _liveView.Stop();
                _liveView = null;
            }

            // Stop all timers
            if (_timerStartCapture != null)
            {
                _timerStartCapture.Dispose();
                _timerStartCapture = null;
            }

            if (_timerWatchDog != null)
            {
                _timerWatchDog.Dispose();
                _timerWatchDog = null;
            }

            StopAfterTimer();
        }
        private void Stop()
        {
            Thread backupPhotosThread = new Thread(() => BackupPhotos());

            backupPhotosThread.Start();

            if (_liveView != null)
            {
                _liveView.Stop();
                _liveView = null;
            }

            _cameraDevice.PhotoCaptured -= DeviceManager_PhotoCaptured;

            if (_timerBeforeStoppingPhoto != null)
            {
                _timerBeforeStoppingPhoto.Dispose();
                _timerBeforeStoppingPhoto = null;
            }
            if (_timerWatchDog != null)
            {
                _timerWatchDog.Dispose();
                _timerWatchDog = null;
            }

            GridPhoto.Dispatcher.Invoke(() => VisibilityManagement(0));

            _playMain(_error);
            Hide();
        }
        public void Open(int nbPhotos, FacesPrinter.PrinterType printer, int nbPrints)
        {
            _nbPhotos = nbPhotos;
            _printer  = printer;
            _nbPrints = nbPrints;
            _error    = false;

            Show();
            VisibilityManagement(1);

            _photos = new List <PhotoPath>();

            _cameraDevice.PhotoCaptured += DeviceManager_PhotoCaptured;
            _cameraDevice.WaitForReady();

            _liveView = new LiveView(_cameraDevice, Stop);
            _liveView.Start(Preview, true);
            _timerPreview = new System.Threading.Timer(OnTimerPreview, null, TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(-1));
        }