private void DefaultNextAction() { if (CurrentFragment == null) { return; } bool isValid = false; bool canGoNext = false; ShowWaitInfo(Resource.String.wizard_validating_title, Resource.String.wizard_validating_story); Task.Run(async() => { try { if (!_isHidden) { isValid = CurrentFragment.Validate(); canGoNext = await CurrentFragment.BeforeGoNextAsync(); } else { WizardCache.CachedAction = () => { Toast.MakeText(this, GetString(Resource.String.action_not_completed), ToastLength.Long).Show(); }; } } catch (Exception exception) { Logger.Error(exception); WizardCache.CachedAction = () => { Toast.MakeText(this, GetString(Resource.String.action_not_completed), ToastLength.Long).Show(); }; } finally { HideWait(); _fragmentButtons.ButtonNextEnabled = false; } if (isValid && canGoNext) { WizardCache.CachedAction = () => { _serializedData = CurrentFragment.GetData(); RunOnUiThread(() => Go(true)); }; if (!_isHidden) { RunCachedAction(); } } }); }
private void DefaultPreviousAction() { if (CurrentFragment == null) { return; } _serializedData = CurrentFragment.GetData(); this.Go(false); }
/// <summary> /// This method will initiate going back or forward depending on boolean given. /// </summary> /// <param name="goNext">True if go next, otherwise pass false</param> public void Go(bool goNext) { _serializedData = CurrentFragment.GetData(); bool goPrevious = !goNext; if (goNext) { if (!CurrentFragment.IsLastStep) { _currentStep++; } _currentFragmentType = CurrentFragment.GetNextFragment(); } else { _currentStep--; if (!StepsHistory.ContainsKey(_currentStep)) { return; } _currentFragmentType = StepsHistory[_currentStep]; } // if the final step, finish the wizard, otherwise load fragment if (!CurrentFragment.IsLastStep || goPrevious) { LoadFragment(); } else { CurrentFragment.FinishWizard(); WizardFinished = true; } }