コード例 #1
0
        /// <summary>
        /// Instantiates a <see cref="PennyPicksEmailStockProvider"/>
        /// </summary>
        /// <param name="emailAlertsAppSettings"></param>
        /// <param name="emailFeedFactory"></param>
        /// <param name="stockParser"></param>
        /// <param name="stockDataProviderFactory"></param>
        /// <param name="stockRetriever"></param>
        public PennyPicksEmailStockProvider(IEmailAlertsAppSettings emailAlertsAppSettings,
            IEmailFeedFactory emailFeedFactory,
            [Dependency(ParserName)] IEmailStockParser stockParser,
            IStockDataProviderFactory stockDataProviderFactory,
            IStockRetriever stockRetriever)
        {
            // check nulls
            if (emailAlertsAppSettings == null) throw new ArgumentNullException("emailAlertsAppSettings");
            if (emailFeedFactory == null) throw new ArgumentNullException("emailFeedFactory");
            if (stockParser == null) throw new ArgumentNullException("stockParser");
            if (stockRetriever == null) throw new ArgumentNullException("stockRetriever");
            
            // create feed
            _feed = emailFeedFactory.CreateFeed(emailAlertsAppSettings.PennyPicksFeedName);
            _feed.NewEmailsFound += FeedOnNewEmailsFound;

            // get the stock data provider
            _stockDataProvider = stockDataProviderFactory.GetStockDataProvider(emailAlertsAppSettings.PennyPicksStockDataProviderName);

            // set stock parser and retriever
            _stockParser = stockParser;
            _stockRetriever = stockRetriever;

            // start feed
            _feed.Start();
        }
コード例 #2
0
        /// <summary>
        /// Instantiates a <see cref="PennyPicksEmailStockProvider"/>
        /// </summary>
        /// <param name="emailAlertsAppSettings"></param>
        /// <param name="emailFeedFactory"></param>
        /// <param name="stockParser"></param>
        /// <param name="stockDataProviderFactory"></param>
        /// <param name="stockRetriever"></param>
        public PennyPicksEmailStockProvider(IEmailAlertsAppSettings emailAlertsAppSettings,
                                            IEmailFeedFactory emailFeedFactory,
                                            [Dependency(ParserName)] IEmailStockParser stockParser,
                                            IStockDataProviderFactory stockDataProviderFactory,
                                            IStockRetriever stockRetriever)
        {
            // check nulls
            if (emailAlertsAppSettings == null)
            {
                throw new ArgumentNullException("emailAlertsAppSettings");
            }
            if (emailFeedFactory == null)
            {
                throw new ArgumentNullException("emailFeedFactory");
            }
            if (stockParser == null)
            {
                throw new ArgumentNullException("stockParser");
            }
            if (stockRetriever == null)
            {
                throw new ArgumentNullException("stockRetriever");
            }

            // create feed
            _feed = emailFeedFactory.CreateFeed(emailAlertsAppSettings.PennyPicksFeedName);
            _feed.NewEmailsFound += FeedOnNewEmailsFound;

            // get the stock data provider
            _stockDataProvider = stockDataProviderFactory.GetStockDataProvider(emailAlertsAppSettings.PennyPicksStockDataProviderName);

            // set stock parser and retriever
            _stockParser    = stockParser;
            _stockRetriever = stockRetriever;

            // start feed
            _feed.Start();
        }