void main_presentation_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (finalized_transition) { if (animaciones_pendientes == 0 && animaciones.Count > 0) { Canvas aux_canvas = (Canvas)((Viewbox)((Grid)main_presentation.Content).Children[1]).Child; this.next_animation = true; Animation aux = animaciones.Peek(); FrameworkElement frame = FindElement(aux.Name_Object, aux_canvas); animaciones_pendientes += Anima.Animate(frame, FindVisualElement(aux.Name_Object), aux, animation_animaciones); frame.Visibility = Visibility.Visible; animaciones.Dequeue(); CreateAnimations(aux_canvas); } else if (animaciones_pendientes == 0 && animaciones.Count == 0) { if (e.ButtonState == MouseButtonState.Pressed) { pos_diap++; if (pos_diap < slides.Count) { CreateQueue(); DoTransition(slides[pos_diap].Transition.ToString()); } else { FinalizePresentation.Invoke(); } } } } }
/// <summary> /// Begin a group of animations that start at the same time /// </summary> /// <param name="canvas">The canvas where are the elements</param> void CreateAnimations(Canvas canvas) { while (animaciones.Count > 0 && next_animation) { Animation aux = animaciones.Peek(); if (aux.Activation == BeginMode.Before) { FrameworkElement frame = FindElement(aux.Name_Object, canvas); animaciones_pendientes += Anima.Animate(frame, FindVisualElement(aux.Name_Object), aux, animation_animaciones); frame.Visibility = Visibility.Visible; animaciones.Dequeue(); } else { next_animation = false; break; } } }
/// <summary> /// Activate a subset of animations, when all the pending animations finished /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void animation_Completed(object sender, EventArgs e) { if (animaciones_pendientes > 0) { animaciones_pendientes--; } if (animaciones_pendientes == 0 && animaciones.Count > 0) { Canvas aux_canvas = (Canvas)((Viewbox)((Grid)main_presentation.Content).Children[1]).Child; Animation aux = animaciones.Peek(); if (aux.Activation != BeginMode.Click) { FrameworkElement frame = FindElement(aux.Name_Object, aux_canvas); animaciones_pendientes += Anima.Animate(frame, FindVisualElement(aux.Name_Object), aux, animation_animaciones); frame.Visibility = Visibility.Visible; animaciones.Dequeue(); next_animation = true; CreateAnimations(aux_canvas); } } }