Esempio n. 1
0
 public HomeController(IHomepageService homepageService, ISubtitleService subtitleService, IWhatIDoService whatIDoService, ITweetsService tweetsService, IViewersService viewersService)
 {
     _homepageService = homepageService;
     _subtitleService = subtitleService;
     _whatIDoService  = whatIDoService;
     _tweetsService   = tweetsService;
     _viewersService  = viewersService;
 }
Esempio n. 2
0
        /// <summary>
        /// Returns fully-hydrated Tweet objects for up to 100 Tweets per request
        /// </summary>
        /// <param name="service">The <see cref="ITweetsService"/> instance to execute the API call</param>
        /// <param name="ids">The sequence of tweet ids to retrieve</param>
        /// <returns>The list of hydrated tweets</returns>
        public static Task <IList <Tweet> > GetTweetsAsync(
            [NotNull] this ITweetsService service,
            [NotNull, ItemNotNull] IEnumerable <string> ids)
        {
            string id = string.Join(",", ids);

            return(service._GetTweetsAsync(id));
        }
Esempio n. 3
0
 public AdminController(IHomepageService homepageService, ISubtitleService subtitleService, IWhatIDoService whatIDoService, ITweetsService tweetsService, IHomeSubtitleService homesubtitleService, SignInManager <ApplicationUser> signinManager, UserManager <ApplicationUser> userManager, IViewersService viewersService)
 {
     _homepageService     = homepageService;
     _subtitleService     = subtitleService;
     _whatIDoService      = whatIDoService;
     _tweetsService       = tweetsService;
     _userManager         = userManager;
     _signinManager       = signinManager;
     _homesubtitleService = homesubtitleService;
     _viewersService      = viewersService;
 }
Esempio n. 4
0
        /// <summary>
        /// Processes tweets from a source file and serializes their expanded content to disk
        /// </summary>
        /// <param name="options">The options to use to execute the operations</param>
        /// <param name="service">The <see cref="ITweetsService"/> instance service to use to retrieve tweets</param>
        /// <param name="callback">An optional callback to notify the user of the progress</param>
        public static async Task ProcessAsync(
            [NotNull] HydratorOptions options,
            [NotNull] ITweetsService service,
            [CanBeNull] Action <int, string> callback = null)
        {
            // Create the actual destination folder
            var folder = Path.Join(options.DestinationFolder, Path.GetFileName(options.SourceFile));

            if (Directory.Exists(folder))
            {
                throw new InvalidOperationException($"The target directory \"{folder}\" already exists");
            }
            Directory.CreateDirectory(folder);

            // Open the source file and process it
            int total     = 0;
            var timestamp = DateTime.MinValue;

            using (var input = File.OpenText(options.SourceFile))
            {
                do
                {
                    // Throttle if needed
                    var difference = DateTime.Now - timestamp;
                    if (difference < TimeSpan.FromSeconds(3))
                    {
                        await Task.Delay(TimeSpan.FromSeconds(3) - difference);
                    }
                    timestamp = DateTime.Now;

                    // Read the new lines
                    var lines = input.TakeLines(100);
                    if (lines.Count == 0)
                    {
                        return;                   // EOF
                    }
                    callback?.Invoke(total, lines[0]);
                    total += lines.Count;

                    // Load the tweets and save them
                    var tweets = await service.GetTweetsAsync(lines);

                    var json = JsonConvert.SerializeObject(tweets, Formatting.Indented, new JsonSerializerSettings {
                        NullValueHandling = NullValueHandling.Ignore
                    });
                    var target = Path.Join(folder, $"{lines[0]}.json");
                    using (var output = File.CreateText(target))
                        output.Write(json);
                } while (options.Limit == 0 || total < options.Limit);
            }
        }
 public TweetsController(ITweetsService tweetsService)
 {
     _tweetsService = tweetsService;
 }
Esempio n. 6
0
 public TweetsController(IConfiguration configuration, ITweetsService tweetsService)
 {
     _configuration = configuration;
     _tweetsService = tweetsService;
 }
Esempio n. 7
0
 public TweetsController(ITweetsService tweets)
 {
     this.tweets = tweets;
 }
 public TweetController(ITweetsService tweets)
 {
     this.tweets = tweets;
 }
Esempio n. 9
0
        public MainPageViewModel(
            IPageNavigationService pageNavigationService,
            IItemsService dataService,
            ITweetsService tweetsService,
            IVideosService youtubeChannelService,
            ISettingsService settingsService,
            IUnityContainer unityContainer,
            IItemsRepository itemsRepository,
            ITweetsRepository tweetsRepository,
            IImagesRepository imagesRepository,
            IVideosRepository videosRepository,
            ICarsRepository carsRepository,
            IFlickrService flickrService,
            ISharingService sharingService)
            : base(
                sharingService,
                pageNavigationService,
                unityContainer)
        {
            _pageNavigationService = pageNavigationService;
            _dataService = dataService;
            _tweetsService = tweetsService;
            _youtubeChannelService = youtubeChannelService;
            _unityContainer = unityContainer;
            _itemsRepository = itemsRepository;
            _tweetsRepository = tweetsRepository;
            _imagesRepository = imagesRepository;
            _videosRepository = videosRepository;
            _flickrService = flickrService;
            _carsRepository = carsRepository;

            //CarModelsCollection = carsRepository.GetAll();

#if WINDOWS_PHONE
            if (DesignerProperties.IsInDesignTool)
#else // !WINDOWS_PHONE
			if (DesignMode.DesignModeEnabled)
#endif
            {
                //InitializeDataForDesignMode();
                InitializeDataFromOnlineAsync();
            }
        }
 public HomeController(ITweetsService tweets, ITagsService tags)
 {
     this.tweets = tweets;
     this.tags = tags;
 }
 public UsersController(ITweetsService tweetsData)
 {
     this.tweetsData = tweetsData;
 }
 public HomeController(ITweetsService tweetsData)
 {
     this.tweetsData = tweetsData;
 }