示例#1
0
        /*============================================================================*/
        /* Private Functions                                                          */
        /*============================================================================*/

        private void ConfigureTransitions()
        {
            _initialize = new LifecycleTransition("LifecycleEvent.PRE_INITIALIZE", this)
                          .FromStates(LifecycleState.UNINITIALIZED)
                          .ToStates(LifecycleState.INITIALIZING, LifecycleState.ACTIVE);
            _initialize.preTransition  += DispatchPreInitialize;
            _initialize.transition     += DispatchInitialize;
            _initialize.postTransition += DispatchPostInitialize;

            _suspend = new LifecycleTransition("LifecycleEvent.PRE_SUSPEND", this)
                       .FromStates(LifecycleState.ACTIVE)
                       .ToStates(LifecycleState.SUSPENDING, LifecycleState.SUSPENDED)
                       .InReverse();
            _suspend.preTransition  += DispatchPreSuspend;
            _suspend.transition     += DispatchSuspend;
            _suspend.postTransition += DispatchPostSuspend;

            _resume = new LifecycleTransition("LifecycleEvent.PRE_RESUME", this)
                      .FromStates(LifecycleState.SUSPENDED)
                      .ToStates(LifecycleState.RESUMING, LifecycleState.ACTIVE);
            _resume.preTransition  += DispatchPreResume;
            _resume.transition     += DispatchResume;
            _resume.postTransition += DispatchPostResume;

            _destroy = new LifecycleTransition("LifecycleEvent.PRE_DESTROY", this)
                       .FromStates(LifecycleState.SUSPENDED, LifecycleState.ACTIVE)
                       .ToStates(LifecycleState.DESTROYING, LifecycleState.DESTROYED)
                       .InReverse();
            _destroy.preTransition  += DispatchPreDestroy;
            _destroy.transition     += DispatchDestroy;
            _destroy.postTransition += DispatchPostDestroy;
        }
示例#2
0
 public void after()
 {
     lifecycle  = null;
     transition = null;
 }
示例#3
0
 public void before()
 {
     lifecycle  = new Lifecycle(new object());
     transition = new LifecycleTransition("test", lifecycle);
 }