public void Finalise() { _worldState = null; _worldState.WorldStateUpdated -= HandleServiceInvocation; _assetServiceRoutines = null; ClearServiceInvocationHandlers(); }
// When world state is updated, checks if any service invocations need to be completed. // Checks if any of the registered handlers can take responsibilty for the service invocation public ServiceRoutineService(WorldStateService worldState, AssetServiceRoutineRepository assetServiceRoutines) { _worldState = worldState; _assetServiceRoutines = assetServiceRoutines; _worldState.WorldStateUpdated += HandleServiceInvocation; _serviceHandlers = new List<IServiceInvocationHandler>(); }
public Simulation() { _worldStateService = new WorldStateService(); _workItemDecomp = new SimpleWorkItemDecomposition(); _goalService = new GoalService(_worldStateService); // Set up database classes _databaseProvider = new MySql.Data.MySqlClient.MySqlClientFactory(); _stateDataAccess = new WorldStateDataAccess(_databaseProvider); _knowledgeDataAccess = new WorldKnowledgeDataAccess(_databaseProvider); _worldStateRepos = new WorldStateRepository(_stateDataAccess); _accessRecordRepos = new AccessRecordRepository(_stateDataAccess); _assetServiceRepos = new AssetServiceRoutineRepository(_stateDataAccess); _methodRepository = new MethodRepository(_knowledgeDataAccess); _activityMethodService = new ActivityMethodService(_methodRepository); // Set up service invocation classes _serviceRoutineService = new ServiceRoutineService(_worldStateService, _assetServiceRepos); _abortHandler = new AbortHandler(); _serviceRoutineService.AddServiceInvocationHandler(_abortHandler); }