コード例 #1
0
        /// <summary>
        /// Handler called every time a state is created in the controller.
        /// </summary>
        /// <param name="state">The state created.</param>
        public virtual void OnNodeStateCreated(IReadOnlyNodeState state)
        {
            Debug.Assert(state != null);
            Debug.Assert(!StateViewTable.ContainsKey(state));

            IReadOnlyNodeStateView StateView = null;

            switch (state)
            {
            case IReadOnlyPatternState AsPatternState:
                StateView = CreatePatternStateView(AsPatternState);
                break;

            case IReadOnlySourceState AsSourceState:
                StateView = CreateSourceStateView(AsSourceState);
                break;

            case IReadOnlyPlaceholderNodeState AsPlaceholderState:
                StateView = CreatePlaceholderNodeStateView(AsPlaceholderState);
                break;

            case IReadOnlyOptionalNodeState AsOptionalState:
                StateView = CreateOptionalNodeStateView(AsOptionalState);
                break;
            }

            Debug.Assert(StateView != null);

            StateViewTable.Add(state, StateView);
        }