public void confirmDenyPhoto(bool _yesNo) { // Hide the yes and no buttons DoubleAnimation daHeight = new DoubleAnimation(0, 150, new Duration(TimeSpan.FromSeconds(0.3))); DoubleAnimation daFHeight = new DoubleAnimation(0, 150, new Duration(TimeSpan.FromSeconds(0.3))); SineEase ease = new SineEase(); ease.EasingMode = EasingMode.EaseIn; daHeight.EasingFunction = ease; daFHeight.EasingFunction = ease; daFHeight.BeginTime = TimeSpan.FromSeconds(0.2); YNSpacer2.BeginAnimation(Canvas.HeightProperty, daFHeight); YNSpacer.BeginAnimation(Canvas.HeightProperty, daHeight); //btnYes.BeginAnimation(Button.MarginProperty // Show take photo DoubleAnimation daOpacity = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5))); txtTakePhoto.Text = "TAKE PHOTO"; txtTakePhoto.BeginAnimation(TextBlock.OpacityProperty, daOpacity); txtStartCountdown.BeginAnimation(TextBlock.OpacityProperty, daOpacity); if (_yesNo == true) { // Captions requestNewCaption(ApplicationStates.STATE_PHOTO_SUBMITTED, false); saveImageFrame(); } else { // Captions requestNewCaption(ApplicationStates.STATE_PHOTO_DESTROYED, false); freezePhoto = false; } }
public void initiatePhotoTake() { // Just in case it's a re-take freezePhoto = false; if (YNSpacer.Height < 150) { DoubleAnimation daHeight = new DoubleAnimation(YNSpacer.Height, 150, new Duration(TimeSpan.FromSeconds(0.3))); DoubleAnimation daFHeight = new DoubleAnimation(YNSpacer2.Height, 150, new Duration(TimeSpan.FromSeconds(0.3))); SineEase ease = new SineEase(); ease.EasingMode = EasingMode.EaseIn; daHeight.EasingFunction = ease; daFHeight.EasingFunction = ease; daFHeight.BeginTime = TimeSpan.FromSeconds(0.2); YNSpacer2.BeginAnimation(Canvas.HeightProperty, daFHeight); YNSpacer.BeginAnimation(Canvas.HeightProperty, daHeight); } if (sfxQueue != null) { sfxQueue = null; } // Disable cursors - way too distracting if (_mainWin != null) { _mainWin.enableDisableAllCursors(false); } // Hide take photo DoubleAnimation daOpacityHide = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromSeconds(0.5))); txtTakePhoto.BeginAnimation(TextBlock.OpacityProperty, daOpacityHide); txtStartCountdown.BeginAnimation(TextBlock.OpacityProperty, daOpacityHide); takePhoto.BeginAnimation(Button.OpacityProperty, daOpacityHide); takePhoto.IsHitTestVisible = false; // Hide the button sfxQueue = new List <string>(); sfxQueue.Add("TDGenBeep.wav"); sfxQueue.Add("TDGenBeep.wav"); sfxQueue.Add("TDGenBeep.wav"); sfxQueue.Add("CameraFlash.mp3"); playSoundEffect(sfxQueue[0]); countDown.Visibility = System.Windows.Visibility.Visible; }
private void nextSFXStep() { if (sfxQueue != null) { sfxQueue.RemoveAt(0); if (sfxQueue.Count > 0) { playSoundEffect(sfxQueue[0]); if (countDown.Visibility == System.Windows.Visibility.Visible) { countDown.Text = Convert.ToString(sfxQueue.Count - 1); } if (sfxQueue.Count == 1) { // Hide the count countDown.Visibility = System.Windows.Visibility.Hidden; countDown.Text = "3"; // Take the photo freezePhoto = true; // Flash the white //DoubleAnimation daFlashW = AnimationHelper.CreateDoubleAnimation(0, this.Width, null, new Duration(TimeSpan.FromSeconds(0.2))); //DoubleAnimation daFlashH = AnimationHelper.CreateDoubleAnimation(0, this.Height, null, new Duration(TimeSpan.FromSeconds(0.2))); DoubleAnimation daFlashOpacity = new DoubleAnimation(0, .8, new Duration(TimeSpan.FromSeconds(0.1))); daFlashOpacity.AutoReverse = true; //camFlash.BeginAnimation(Ellipse.WidthProperty, daFlashW); //camFlash.BeginAnimation(Ellipse.HeightProperty, daFlashH); camFlash.BeginAnimation(Ellipse.OpacityProperty, daFlashOpacity); } } else { sfxQueue = null; // Done destroySFXPlayer(); // Show retake photo txtTakePhoto.Text = "RE-TAKE PHOTO"; DoubleAnimation daOpacity = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5))); daOpacity.BeginTime = TimeSpan.FromSeconds(6); txtTakePhoto.BeginAnimation(TextBlock.OpacityProperty, daOpacity); txtStartCountdown.BeginAnimation(TextBlock.OpacityProperty, daOpacity); takePhoto.BeginAnimation(Button.OpacityProperty, daOpacity); takePhoto.IsHitTestVisible = true; // show yes or no button DoubleAnimation daHeight = new DoubleAnimation(150, 0, new Duration(TimeSpan.FromSeconds(0.3))); DoubleAnimation daHeightF = new DoubleAnimation(150, 0, new Duration(TimeSpan.FromSeconds(0.3))); SineEase ease = new SineEase(); ease.EasingMode = EasingMode.EaseOut; daHeight.EasingFunction = ease; daHeightF.EasingFunction = ease; daHeight.BeginTime = TimeSpan.FromSeconds(6); daHeightF.BeginTime = TimeSpan.FromSeconds(6.2); // Add a tiny delay YNSpacer.BeginAnimation(Canvas.HeightProperty, daHeight); YNSpacer2.BeginAnimation(Canvas.HeightProperty, daHeightF); // Captions requestNewCaption(ApplicationStates.STATE_LOOKINGGOOD, false); requestNewCaption(ApplicationStates.STATE_SUBMISSION_AGREE, true); requestNewCaption(ApplicationStates.STATE_YES_NOPHOTO, true); // Re-enable the cursors if (_mainWin != null) { _mainWin.enableDisableAllCursors(true); } } } }