Exemple #1
0
        /// <summary>
        /// Handles the Lesson fragement's iteration finished event
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        async void Fragment_IterationFinished(object sender, IterationFinishedEventArgs e)
        {
            // Update status
            var iterationIndex = DataHolder.Current.CurrentLesson.Iterations.IndexOf(e.Iteration);

            progressList.ElementAt(iterationIndex).Status    = e.Success ? IterationStatus.Success : IterationStatus.Failed;
            progressList.ElementAt(iterationIndex).IsCurrent = false;
            rvProgress.GetAdapter().NotifyItemChanged(iterationIndex);

            // Show success animation
            if (e.ProvideFeedback)
            {
                if (e.Success)
                {
                    ivBadge.SetImageResource(Resource.Drawable.ic_irmgard_icon_spiel_richtig_neu);
                }
                else
                {
                    ivBadge.SetImageResource(Resource.Drawable.ic_irmgard_icon_spiel_falsch);
                }

                var animation = AnimationUtils.LoadAnimation(this, Resource.Animation.ShowFeedbackIcon);
                animation.AnimationEnd += (s, args) => ivBadge.Visibility = ViewStates.Gone;
                ivBadge.Visibility      = ViewStates.Visible;
                ivBadge.StartAnimation(animation);
            }

            // Stop Player
            SoundPlayer.Stop();

            // Save changes
            await DataHolder.Current.SaveProgressAsync();
        }
        /// <summary>
        /// Handles the lesson fragement's iteration finished event
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void Fragment_IterationFinished(object sender, IterationFinishedEventArgs e)
        {
            //TODO: Add Thumbs Up Animation here
            //Toast.MakeText (this, "Iteration finished!", ToastLength.Short).Show();

            // Update status
            var iterationIndex = DataHolder.Current.CurrentLesson.Iterations.IndexOf(e.Iteration);
            progressList.ElementAt(iterationIndex).Status = e.Success ? ProgressStatus.Success : ProgressStatus.Failed;
            rvProgress.GetAdapter().NotifyItemChanged(iterationIndex);

            // Stop Player
            SoundPlayer.Stop();
        }
        /// <summary>
        /// Handles the Lesson fragement's iteration finished event
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        async void Fragment_IterationFinished(object sender, IterationFinishedEventArgs e)
        {
            // Update status
            var iterationIndex = DataHolder.Current.CurrentLesson.Iterations.IndexOf(e.Iteration);
            progressList.ElementAt(iterationIndex).Status = e.Success ? IterationStatus.Success : IterationStatus.Failed;
            progressList.ElementAt(iterationIndex).IsCurrent = false;
            rvProgress.GetAdapter().NotifyItemChanged(iterationIndex);

            // Show success animation
            if (e.ProvideFeedback)
            {
                if (e.Success)
                    ivBadge.SetImageResource(Resource.Drawable.ic_irmgard_icon_spiel_richtig_neu);
                else
                    ivBadge.SetImageResource(Resource.Drawable.ic_irmgard_icon_spiel_falsch);

                var animation = AnimationUtils.LoadAnimation(this, Resource.Animation.ShowFeedbackIcon);
                animation.AnimationEnd += (s, args) => ivBadge.Visibility = ViewStates.Gone;
                ivBadge.Visibility = ViewStates.Visible;
                ivBadge.StartAnimation(animation);
            }

            // Stop Player
            SoundPlayer.Stop();

            // Save changes
            await DataHolder.Current.SaveProgressAsync();
        }