Beispiel #1
0
        static async Task LoadTweets(string tweetServiceUrl, string resultFileName, DateTime startDate, DateTime endDate)
        {
            TweetService        service  = new TweetService(tweetServiceUrl);
            TweetLoader         loader   = new TweetLoader(service);
            TweetLoaderResponse response = await loader.LoadTweetsByDate(startDate, endDate).ConfigureAwait(false);

            if (!string.IsNullOrEmpty(response.ErrorMessage))
            {
                Console.WriteLine("Error while loading tweets: " + response.ErrorMessage);
            }
            else
            {
                Console.WriteLine("Loaded tweets count: " + response.Tweets.Count);
            }
            if (!string.IsNullOrEmpty(resultFileName) && response.Tweets != null)
            {
                try
                {
                    loader.SaveToFile(response.Tweets, resultFileName);
                    Console.WriteLine("Saved tweets to: " + resultFileName);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error while saving tweets: " + ex.Message);
                }
            }
        }
Beispiel #2
0
        public void CheckLoader()
        {
            TestTweetService testService = new TestTweetService("Mock\\testData.txt");
            TweetLoader      loader      = new TweetLoader(testService);
            DateTime         startDate   = new DateTime(2016, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
            DateTime         endDate     = new DateTime(2018, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddTicks(-1);
            var response = loader.LoadTweetsByDate(startDate, endDate).GetAwaiter().GetResult();

            Assert.IsTrue(string.IsNullOrEmpty(response.ErrorMessage));
            Assert.IsTrue(response.Tweets.Count == testService.TotalTweetCount);
        }
Beispiel #3
0
        public ExtendedListBox()
        {
            Loader        = new TweetLoader();
            viewportItems = new Dictionary <ITweetable, ContentPresenter>();

            ActivatePullToRefresh = true;
            AutoManageNavigation  = true;
            AutoManageErrors      = true;

            selectionChangeFired = false;
            lastAutoReload       = DateTime.MinValue;
            if (lastErrorFired == null)
            {
                lastErrorFired = DateTime.MinValue;
            }

            this.Loaded           += OnLoad;
            this.SelectionChanged += ManageNavigation;
#if WP7
            this.Link   += ExtendedListBox_Link;
            this.Unlink += ExtendedListBox_Unlink;

            this.IsFlatList = true;
#elif WP8
            this.ItemRealized   += OnItemRealized;
            this.ItemUnrealized += OnItemUnrealized;
#endif


            ExtendedListBox.SaveViewports += this.SaveInstanceViewport;

            Loader.Error        += new TweetLoader.OnError(Loader_Error);
            Loader.CacheLoad    += new EventHandler(Loader_CacheLoad);
            Loader.LoadFinished += Loader_LoadFinished;
            SetupCollectionViewSource();

            this.Background = new SolidColorBrush(Colors.Transparent);

            scrollController  = Dependency.Resolve <IScrollController>();
            readingPosManager = Dependency.Resolve <IReadingPositionManager>();
            pullDetector      = Dependency.Resolve <IListboxCompressionDetector>();
        }
Beispiel #4
0
 public HomeController(IConfiguration configuration)
 {
     _configuration = configuration;
     _loader        = new TweetLoader(new TweetService(_configuration.GetValue("AppSettings:TweetServiceUrl", "")));
 }