Exemplo n.º 1
0
        public void TestSubscribe()
        {
            var messageBus = MessageBus.GetInstance();

            messageBus.Subscribe <MessageModel>(GetMessage);
            messageBus.Emit(_msg);
        }
Exemplo n.º 2
0
 public void Close()
 {
     MessageBus.GetInstance().UnRegister(this);
     ViewPager       = null;
     WizardFlow      = null;
     FragmentManager = null;
     StateManager    = null;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Notify the wizard that this step is incomplete
 /// </summary>
 public void NotifyIncomplete()
 {
     lock (LockObject) {
         if (StepCompleted == true)   //Step was previously marked complete.. We are reversing the call, so raise the event
         {
             MessageBus.GetInstance().Publish(new StepCompletedEvent(false, this /*wizardStep*/));
             StepCompleted = false;
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Notify the wizard that this step is completed
 /// </summary>
 public void NotifyCompleted()
 {
     lock (LockObject) {
         if (StepCompleted == false)   //Step was not marked complete prior to this call, so raise the step completion event
         {
             MessageBus.GetInstance().Publish(new StepCompletedEvent(true, this /*wizardStep*/));
             StepCompleted = true;
         }
     }
 }
Exemplo n.º 5
0
        public void TestUnSubscribe()
        {
            var messageBus = MessageBus.GetInstance();
            var token      = messageBus.Subscribe <MessageModel>(s =>
            {
                Assert.Fail("This should not be executed due to unsubscribing.");
            });

            messageBus.Unsubscribe(token);
            messageBus.Emit(_msg);
        }
Exemplo n.º 6
0
        /// <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
        }