Beispiel #1
0
        public BEServiceLogic(IEventAggregator aggregator, IBEService beService, ISettingsStoreSource settingsStoreSource, IBELogic beLogic)
        {
            _aggregator          = aggregator;
            _beService           = beService;
            _settingsStoreSource = settingsStoreSource;
            _beLogic             = beLogic;

            _playersUpdater = new TimedAction(_settingsStoreSource.GetSettingsStore().PlayersUpdateSeconds, UpdatePlayers);
            _bansUpdater    = new TimedAction(_settingsStoreSource.GetSettingsStore().BansUpdateSeconds, UpdateBans);

            _aggregator.GetEvent <SettingsChangedEvent>()
            .Subscribe(SettingsChanged);


            _beLogic.ServerUpdateHandler += _beLogic_ServerUpdateHandler;
        }
        public BEServiceLogic(IEventAggregator aggregator, BEService beService, ILog log)
        {
            _aggregator = aggregator;
            _beService  = beService;

            _playersUpdater = new TimedAction(SettingsStore.Instance.PlayersUpdateSeconds, UpdatePlayers, log);
            _bansUpdater    = new TimedAction(SettingsStore.Instance.BansUpdateSeconds, UpdateBans, log);

            _aggregator.GetEvent <SettingsChangedEvent>()
            .Subscribe(SettingsChanged);

            _aggregator.GetEvent <BEMessageEvent <BECommand> >().Subscribe(ProcessCommand, ThreadOption.BackgroundThread);

            _aggregator.GetEvent <BEMessageEvent <BEPlayerLogMessage> >().Subscribe(Proc_BEPlayerLogMessage, ThreadOption.BackgroundThread);
            _aggregator.GetEvent <ConnectServerEvent>().Subscribe(BeServerConnectHandler, ThreadOption.BackgroundThread);
        }