コード例 #1
0
        public override Fragment GetItem(int position)
        {
            var wizardStep = WizardFlow.GetSteps()[position];

            StateManager.LoadStepContext(wizardStep);
            return(wizardStep);
        }
コード例 #2
0
 public WizardPagerAdapter(FragmentManager fragmentManager, WizardFlow wizardFlow, IStateManager stateManager, Wizard wizard)
     : base(fragmentManager)
 {
     WizardFlow   = wizardFlow;
     StateManager = stateManager;
     Wizard       = wizard;
 }
コード例 #3
0
 public WizardPagerAdapter(FragmentManager fragmentManager, WizardFlow wizardFlow, IStateManager stateManager, Wizard wizard)
     : base(fragmentManager)
 {
     WizardFlow = wizardFlow;
     StateManager = stateManager;
     Wizard = wizard;
 }
コード例 #4
0
        /// <summary>
        /// Called once the fragment is associated with its activity.
        /// </summary>
        /// <param name="activity"></param>
        public override void OnAttach(Android.App.Activity activity)
        {
            base.OnAttach(activity);

            WizardFlow = OnSetup(); //Require the user to Setup the Wizard flow when the fragment is attached 

            if (WizardFlow == null) 
                throw new ArgumentException("Error setting up the Wizard's flow. You must override WizardFragment.OnSetup and create a WizardFlow using the WizardFlow.Builder.");
        }
コード例 #5
0
        /// <summary>
        /// Called once the fragment is associated with its context.
        /// </summary>
        /// <param name="context"></param>
        public override void OnAttach(Context context)
        {
            base.OnAttach(context);

            WizardFlow = OnSetup(); //Require the user to Setup the Wizard flow when the fragment is attached

            if (WizardFlow == null)
            {
                throw new ArgumentException("Error setting up the Wizard's flow. You must override WizardFragment.OnSetup and create a WizardFlow using the WizardFlow.Builder.");
            }
        }
コード例 #6
0
ファイル: Wizard.cs プロジェクト: bhogarajusneha/SmartApp
        /// <summary>
        /// Constructs the Wizard
        /// </summary>
        /// <param name="wizardFlow">WizardFlow instance. See WizardFlow.Builder for more information on creating WizardFlow objects</param>
        /// <param name="contextManager"></param>
        /// <param name="callbacks"></param>
        /// <param name="fragmentManager"></param>
        public Wizard(WizardFlow wizardFlow,
                      IStateManager stateManager,
                      FragmentManager fragmentManager)
        {
            this.WizardFlow      = wizardFlow;
            this.StateManager    = stateManager;
            this.FragmentManager = fragmentManager;


            FragmentManager.BackStackChanged += (o, sender) =>
            {
                if (FragmentManager.BackStackEntryCount < ViewPager.CurrentItem)                //Backbutton has been pressed
                {
                    ViewPager.SetCurrentItem(ViewPager.CurrentItem - 1, true /*smoothScroll*/); // Go to the previous item on the stack
                }
            };

            MessageBus.GetInstance().Register(this, typeof(StepCompletedEvent)); //Listen for the StepCompeltedEvent on the buss
        }
コード例 #7
0
ファイル: Wizard.cs プロジェクト: bhogarajusneha/SmartApp
        public void Receive <T>(T eventArgs)
        {
            var stepCompletedEvent = eventArgs as StepCompletedEvent;

            if (stepCompletedEvent == null || stepCompletedEvent.WizardStep != CurrentStep)
            {
                return;
            }

            // Check that the step is not already in this state to avoid spamming the viewpager
            if (WizardFlow.IsStepCompleted(ViewPager.CurrentItem) == stepCompletedEvent.IsStepCompleted)
            {
                return;
            }

            WizardFlow.SetStepCompleted(ViewPager.CurrentItem, stepCompletedEvent.IsStepCompleted);

            ViewPager.Adapter.NotifyDataSetChanged(); //Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.

            if (StepChanged != null)                  //Trigger the Event handler.. may be used to refresh the UI
            {
                StepChanged();
            }
        }
コード例 #8
0
ファイル: Wizard.cs プロジェクト: bhogarajusneha/SmartApp
 private void ProcessStepBeforeChange(WizardStep wizardStep, int position)
 {
     wizardStep.OnExit(StepExitCode.ExitNext);
     WizardFlow.SetStepCompleted(position, true);
     StateManager.PersistStepContext(wizardStep);
 }