Ejemplo n.º 1
0
        public StocksManager(IServiceProvider services, IMainModel mainModel, ILogger <StocksManager> logger,
                             ISettingsProvider settingsProvider, IEventAggregator2 eventAggregator)
        {
            _settingsProvider = settingsProvider;
            _services         = services;
            _mainModel        = mainModel;
            _logger           = logger;
            EventAggregator   = eventAggregator;
            EventAggregator.Subscribe(this);

            Init();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Subscribes an instance to all events declared through implementations of <see cref = "IHandler{T}" />.
 /// </summary>
 /// <remarks>The subscription is invoked on a new background thread.</remarks>
 /// <param name="eventAggregator"></param>
 /// <param name = "subscriber">The instance to subscribe for event publication.</param>
 public static void SubscribeOnBackgroundThread(this IEventAggregator2 eventAggregator, object subscriber)
 {
     eventAggregator.Subscribe(subscriber, f => Task.Factory.StartNew(f, default, TaskCreationOptions.None, TaskScheduler.Default));
Ejemplo n.º 3
0
 /// <summary>
 /// Subscribes an instance to all events declared through implementations of <see cref = "IHandler{T}" />.
 /// </summary>
 /// <remarks>The subscription is invoked on the thread chosen by the publisher.</remarks>
 /// <param name="eventAggregator"></param>
 /// <param name = "subscriber">The instance to subscribe for event publication.</param>
 public static void SubscribeOnPublishedThread(this IEventAggregator2 eventAggregator, object subscriber)
 {
     eventAggregator.Subscribe(subscriber, f => f());
 }