コード例 #1
0
 /// <summary>
 /// Creates an instance of a state if necessary.
 /// </summary>
 internal void InstantiateState()
 {
     // Should a new instance be created?
     if ((_stateInstance == null) || (_owningMachine._stateInstantiationMode == StateInstantiationMode.PerTransition))
     {
         _stateInstance = _owningMachine.InstantiateState(_stateType);
     }
 }
コード例 #2
0
ファイル: StateConfiguration.cs プロジェクト: mesh42/vpnet
            /// <summary>
            /// Exits the state that this configuration is linked to.
            /// </summary>
            internal void Exit()
            {
                if (_stateInstance != null)
                {
                    _stateInstance.Exiting(_owningMachine.GetContext());

                    // If we're instantiating per transition, we release the reference to the instance
                    if (_owningMachine._stateInstantiationMode == StateInstantiationMode.PerTransition)
                    {
                        _stateInstance = null;
                    }
                }
            }