private async void ScenarioClose() { try { if (m_bPhotoSequence) { ShowStatusMessage("Stopping PhotoSequence"); await m_photoSequenceCapture.FinishAsync(); m_photoSequenceCapture = null; m_bPhotoSequence = false; m_framePtr = null; } if (m_bPreviewing) { await m_capture.StopPreviewAsync(); m_bPreviewing = false; } if (m_capture != null) { previewElement4.Source = null; m_capture.Dispose(); } } catch (Exception exception) { ShowExceptionMessage(exception); } }
private void ScenarioInit() { try { btnStartDevice4.IsEnabled = true; btnStartPreview4.IsEnabled = false; btnStartStopPhotoSequence.IsEnabled = false; btnStartStopPhotoSequence.Content = "Prepare PhotoSequence"; btnSaveToFile.IsEnabled = false; m_bPreviewing = false; m_bPhotoSequence = false; previewElement4.Source = null; m_photoSequenceCapture = null; Clear(); //user can set the maximum history frame number m_pastFrame = 5; ////user can set the maximum future frame number m_futureFrame = 5; m_framePtr = new Windows.Media.Capture.CapturedFrame[m_pastFrame + m_futureFrame]; m_frameNum = 0; m_ThumbnailNum = 0; m_selectedIndex = -1; m_highLighted = false; } catch (Exception e) { ShowExceptionMessage(e); } }
private async void btnStartStopPhotoSequence_Click(Object sender, Windows.UI.Xaml.RoutedEventArgs e) { try { if (btnStartStopPhotoSequence.Content.ToString() == "Prepare PhotoSequence") { if (!m_capture.VideoDeviceController.LowLagPhotoSequence.Supported) { rootPage.NotifyUser("Photo-sequence is not supported", NotifyType.ErrorMessage); } else { if (m_capture.VideoDeviceController.LowLagPhotoSequence.MaxPastPhotos < m_pastFrame) { m_pastFrame = m_capture.VideoDeviceController.LowLagPhotoSequence.MaxPastPhotos; rootPage.NotifyUser("pastFrame number is past limit, reset passFrame number", NotifyType.ErrorMessage); } btnStartStopPhotoSequence.IsEnabled = false; m_capture.VideoDeviceController.LowLagPhotoSequence.ThumbnailEnabled = true; m_capture.VideoDeviceController.LowLagPhotoSequence.DesiredThumbnailSize = 300; m_capture.VideoDeviceController.LowLagPhotoSequence.PhotosPerSecondLimit = 4; m_capture.VideoDeviceController.LowLagPhotoSequence.PastPhotoLimit = m_pastFrame; LowLagPhotoSequenceCapture photoCapture = await m_capture.PrepareLowLagPhotoSequenceCaptureAsync(ImageEncodingProperties.CreateJpeg()); photoCapture.PhotoCaptured += new Windows.Foundation.TypedEventHandler <LowLagPhotoSequenceCapture, PhotoCapturedEventArgs>(this.photoCapturedEventHandler); m_photoSequenceCapture = photoCapture; btnStartStopPhotoSequence.Content = "Take PhotoSequence"; btnStartStopPhotoSequence.IsEnabled = true; m_bPhotoSequence = true; } } else if (btnStartStopPhotoSequence.Content.ToString() == "Take PhotoSequence") { btnSaveToFile.IsEnabled = false; m_frameNum = 0; m_ThumbnailNum = 0; m_selectedIndex = -1; m_highLighted = false; Clear(); btnStartStopPhotoSequence.IsEnabled = false; await m_photoSequenceCapture.StartAsync(); } else { rootPage.NotifyUser("Bad photo-sequence state", NotifyType.ErrorMessage); } } catch (Exception exception) { ShowExceptionMessage(exception); } }
private async void btnStartStopPhotoSequence_Click(Object sender, Windows.UI.Xaml.RoutedEventArgs e) { try { if (btnStartStopPhotoSequence.Content.ToString() == "Prepare PhotoSequence") { if (!m_capture.VideoDeviceController.LowLagPhotoSequence.Supported) { rootPage.NotifyUser("Photo-sequence is not supported", NotifyType.ErrorMessage); } else { if (m_capture.VideoDeviceController.LowLagPhotoSequence.MaxPastPhotos < m_pastFrame) { m_pastFrame = m_capture.VideoDeviceController.LowLagPhotoSequence.MaxPastPhotos; rootPage.NotifyUser("pastFrame number is past limit, reset passFrame number", NotifyType.ErrorMessage); } btnStartStopPhotoSequence.IsEnabled = false; m_capture.VideoDeviceController.LowLagPhotoSequence.ThumbnailEnabled = true; m_capture.VideoDeviceController.LowLagPhotoSequence.DesiredThumbnailSize = 300; m_capture.VideoDeviceController.LowLagPhotoSequence.PhotosPerSecondLimit = 4; m_capture.VideoDeviceController.LowLagPhotoSequence.PastPhotoLimit = m_pastFrame; LowLagPhotoSequenceCapture photoCapture = await m_capture.PrepareLowLagPhotoSequenceCaptureAsync(ImageEncodingProperties.CreateJpeg()); photoCapture.PhotoCaptured += new Windows.Foundation.TypedEventHandler<LowLagPhotoSequenceCapture, PhotoCapturedEventArgs>(this.photoCapturedEventHandler); m_photoSequenceCapture = photoCapture; btnStartStopPhotoSequence.Content = "Take PhotoSequence"; btnStartStopPhotoSequence.IsEnabled = true; m_bPhotoSequence = true; } } else if (btnStartStopPhotoSequence.Content.ToString() == "Take PhotoSequence") { btnSaveToFile.IsEnabled = false; m_frameNum = 0; m_ThumbnailNum = 0; m_selectedIndex = -1; m_highLighted = false; Clear(); btnStartStopPhotoSequence.IsEnabled = false; await m_photoSequenceCapture.StartAsync(); } else { rootPage.NotifyUser("Bad photo-sequence state", NotifyType.ErrorMessage); } } catch (Exception exception) { ShowExceptionMessage(exception); } }
private async void ScenarioClose() { try { if (m_bPhotoSequence) { ShowStatusMessage("Stopping PhotoSequence"); await m_photoSequenceCapture.FinishAsync(); m_photoSequenceCapture = null; m_bPhotoSequence = false; m_framePtr = null; } if (m_bPreviewing) { await m_capture.StopPreviewAsync(); m_bPreviewing = false; } if (m_capture != null) { previewElement4.Source = null; m_capture.Dispose(); } } catch (Exception exception) { ShowExceptionMessage(exception); } }
private void ScenarioInit() { try { btnStartDevice4.IsEnabled = true; btnStartPreview4.IsEnabled = false; btnStartStopPhotoSequence.IsEnabled = false; btnStartStopPhotoSequence.Content = "Prepare PhotoSequence"; btnSaveToFile.IsEnabled = false; m_bPreviewing = false; m_bPhotoSequence = false; previewElement4.Source = null; m_photoSequenceCapture = null; Clear(); //user can set the maximum history frame number m_pastFrame = 5; ////user can set the maximum future frame number m_futureFrame = 5; m_framePtr = new Windows.Media.Capture.CapturedFrame[m_pastFrame + m_futureFrame]; m_frameNum = 0; m_ThumbnailNum = 0; m_selectedIndex = -1; m_highLighted = false; } catch (Exception e) { ShowExceptionMessage(e); } }