Esempio n. 1
0
        async Task DoShow(CancellationToken cancellationToken)
        {
            if (IsCoaching)
            {
                throw new InvalidOperationException("Coaching is under process.");
            }

            CancellationToken = cancellationToken;
            SkipTapped        = false;
            CurrentStep currentStep = null;

            try
            {
                // Create and show background which contains the next and skip button
                await AddButtons(cancellationToken);

                for (Index = 0; Index < stepsList.Count; Index++)
                {
                    var step = stepsList[Index];

                    FixButtonsConditions();

                    if (ShouldItTerminate())
                    {
                        return;
                    }

                    // Show the step by showing it text and element.
                    currentStep = await ShowStep(step);

                    if (ShouldItTerminate())
                    {
                        return;
                    }

                    // Wait for next, skip or time delay (If applicable) to continue.
                    if (Settings.MoveOnByTime)
                    {
                        await Task.WhenAny(OnNextTapped.Task, OnSkipTapped.Task, OnBackTapped.Task, currentStep.OnPopOverClosed.Task, Task.Delay(Settings.Delay));
                    }
                    else
                    {
                        await Task.WhenAny(OnNextTapped.Task, OnSkipTapped.Task, OnBackTapped.Task, currentStep.OnPopOverClosed.Task);
                    }

                    if (ShouldItTerminate())
                    {
                        return;
                    }

                    // Hide the step by showing it text and element.
                    await HideStep(currentStep);
                }
            }
            finally
            {
                await Task.WhenAll(RemoveButtons(), HideStep(currentStep));
            }
        }
Esempio n. 2
0
        async Task HideStep(CurrentStep currentStep)
        {
            if (currentStep == null)
            {
                return;
            }

            await currentStep.Hide();
        }
Esempio n. 3
0
        async Task <CurrentStep> ShowStep(Step step)
        {
            OnNextTapped = new TaskCompletionSource <bool>();
            OnSkipTapped = new TaskCompletionSource <bool>();
            OnBackTapped = new TaskCompletionSource <bool>();

            var currentStep = new CurrentStep(step.Element, step.Text, Settings);

            await currentStep.Show();

            return(currentStep);
        }