Ejemplo n.º 1
0
        public void Init()
        {
            LoadExchanges();

            _publisher.GetEvent <TimerTickElapsedEvent>().Subscribe(OnTickEvent);
            _publisher.GetEvent <UserSettingsUpdatedEvent>().Subscribe(OnSettingsUpdate);
        }
Ejemplo n.º 2
0
        public RemoteDataManager(IEventPublisher publisher)
        {
            CurrentBitcoinPrice = 0;
            _staTaskScheduler   = new StaTaskScheduler(Environment.ProcessorCount);
            _exchanges          = new List <IExchangeWrapper>();
            _publisher          = publisher;

            _publisher.GetEvent <UserSettingsUpdatedEvent>().Subscribe(OnSettingsUpdate);
        }
Ejemplo n.º 3
0
        public ConfigurationManager(IEventPublisher publisher, IFileService fileService)
        {
            _publisher   = publisher;
            _fileService = fileService;

            _configFilePath = $"{Environment.CurrentDirectory}\\{ConfigFilename}";

            _publisher.Publish(new UserSettingsUpdatedEvent(this, CurrentConfiguration));
            _publisher.GetEvent <UserSettingsUpdatedEvent>().Subscribe(OnSettingsUpdate);
        }
Ejemplo n.º 4
0
        public TimerManager(IEventPublisher publisher)
        {
            _publisher = publisher;

            _publisher
            .GetEvent <UserSettingsUpdatedEvent>()
            .Subscribe(OnUserSettingsUpdate);

            _timer          = new Timer(_interval * 1000);
            _timer.Elapsed += Update;
            _timer.Start();
        }
Ejemplo n.º 5
0
 public ServiceBoot
 (
     ILogFactory logFactory,
     IServiceInstance serviceInstance,
     IEventPublisher <IServiceRequest> serviceEventPublisher
 )
 {
     _log             = logFactory.GetLogger(this);
     _serviceInstance = serviceInstance;
     serviceEventPublisher.GetEvent <GracefulShutdownRequest>()
     .Take(1)                      // One is enough.
     .Subscribe(OnGracefulShutdownRequest);
 }
        public SubscriptionService(IEventPublisher eventPublisher)
        {
            _subscriptions = new List <IDisposable>();

            VerifyArgument.IsNotNull("eventPublisher", eventPublisher);
            _events = eventPublisher.GetEvent <TEvent>();


            // Don't observe on dispatcher if this is a background thread!
            try
            {
                var dispatcher = Dispatcher.CurrentDispatcher;
                if (dispatcher.CheckAccess() && !dispatcher.Thread.IsBackground)
                {
                    _events = _events.ObserveOnDispatcher();
                }
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
                // FOR TESTING FUNNIES!!
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Get event producer
 /// </summary>
 /// <typeparam name="TEvent"></typeparam>
 /// <returns></returns>
 #endregion // Documentation
 public static IObservable <TEvent> GetEvent <TEvent>()
 {
     return(s_eventPublisher.GetEvent <TEvent>());
 }
Ejemplo n.º 8
0
 public ShortLivedEventBusSubscriber(IEventPublisher publisher)
 {
     Interlocked.Increment(ref Count);
     publisher.GetEvent <string>().Subscribe(s => LatestMessage = s);
 }
Ejemplo n.º 9
0
 protected Logger(Type caller, IEventPublisher <IServiceRequest> eventPublisher) : this(caller)
 {
     eventPublisher.GetEvent <DayRollRequest>()
     .Subscribe(PerformDayRoll);
 }