Example #1
0
        public static void InitializeContainers()
        {
            CityLogic  _cityLogic  = new CityLogic();
            StateLogic _stateLogic = new StateLogic();

            var cities = _cityLogic.GetAll();

            foreach (var city in cities)
            {
                _cityViewModels.Add(new CityViewModel()
                {
                    Id = city.Id, StateId = city.StateId, Title = city.Title
                });
            }

            var states = _stateLogic.GetAll();

            foreach (var state in states)
            {
                _stateViewModels.Add(new StateViewModel()
                {
                    Id = state.Id, Title = state.Title, Latitude = state.Latitude.HasValue ? state.Latitude.Value : 0, Longitude = state.Longitude.HasValue ? state.Longitude.Value : 0
                });
            }
        }
 public BeneficiaryController()
 {
     _logic         = new BeneficiaryLogic();
     _employeeLogic = new EmployeeLogic();
     _relationLogic = new RelationLogic();
     _stateLogic    = new StateLogic();
 }
Example #3
0
        public StateMachine <TState, TEvent> Build()
        {
            var factory         = new StandardFactory <TState, TEvent>();
            var transitionLogic = new TransitionLogic <TState, TEvent>(this.stateContainer, this.stateContainer);
            var stateLogic      = new StateLogic <TState, TEvent>(transitionLogic, this.stateContainer, this.stateContainer);

            transitionLogic.SetStateLogic(stateLogic);

            return(new StateMachine <TState, TEvent>(factory, stateLogic));
        }
        public ActiveStateMachine <TState, TEvent> CreateActiveStateMachine(string name)
        {
            var stateContainer = new StateContainer <TState, TEvent>(name);

            foreach (var stateIdAndLastActiveState in this.initiallyLastActiveStates)
            {
                stateContainer.SetLastActiveStateFor(stateIdAndLastActiveState.Key, stateIdAndLastActiveState.Value);
            }

            var transitionLogic = new TransitionLogic <TState, TEvent>(stateContainer, stateContainer);
            var stateLogic      = new StateLogic <TState, TEvent>(transitionLogic, stateContainer, stateContainer);

            transitionLogic.SetStateLogic(stateLogic);

            var standardFactory = new StandardFactory <TState, TEvent>();
            var stateMachine    = new StateMachine <TState, TEvent>(standardFactory, stateLogic);

            return(new ActiveStateMachine <TState, TEvent>(stateMachine, stateContainer, this.stateDefinitions, this.initialState));
        }
Example #5
0
 /*
  *      boardSize.X is the number of columns on the Tetris board and boardSize.Y is the row count.
  *
  *      The score store is responsible for loading and saving player scores between instances/sessions.
  *      The library provides the implementation PlayerScoreFile, but it's a possible customization point.
  *      Some front end might want to store the player score in a database on the internet and thus use another score store.
  */
 public TetrisGame(Vec2i boardSize, IScoreStore <PlayerScore> scoreStore)
 {
     _stateLogic = new StateLogic(scoreStore);
     _boardLogic = new BoardLogic(boardSize, _stateLogic);
 }