Пример #1
0
        private void InitialComponent()
        {
            _grid.Bind(new List<RecordModel>{
                new RecordModel{ID = "001", Name = "First Record"},
                new RecordModel{ID = "002", Name = "Second Record"}
            });

            State initialState = new State("Initial State", () => {
                _header.Enabled = true;
                _grid.Enabled = false;
            });

            State gridState = new State("Grid State", () => {
                _header.Enabled = false;
                _grid.Enabled = true;
            });

            initialState.OnStateEntered += Display;
            gridState.OnStateEntered += Display;

            initialState.SetupStateItem(Operation.SCROLL_DOWN, OperationResult.NORMALLY, gridState);
            gridState.SetupStateItem(Operation.SCROLL_UP, OperationResult.GRID_TOP, initialState);

            _currentState = initialState;
            _currentState.Enter();
        }
Пример #2
0
 public void Operate(Operation op)
 {
     _currentState = _currentState.Operate(op, _grid.Operate(op));
     _currentState.Enter();
 }