Exemplo n.º 1
0
        // 다음 글 목록 얻어오기
        private async void GetNextArticleList()
        {
            nextPageButton.IsEnabled = false;
            LoadingArticleListProgressBar.IsIndeterminate = true;

            CancellationTokenSource cts = new CancellationTokenSource();

            try
            {
                IEnumerable <IArticle> newArticles = null;
                bool bEnded = await Task.Factory.StartNew(
                    () => { return(articleLister.Next(cts.Token, out newArticles)); }, cts.Token);

                // TODO: 리스트의 마지막일때 처리

                foreach (var item in newArticles)
                {
                    ArticleList.Items.Insert(ArticleList.Items.Count - 1, new ArticleViewModel(item));
                }
            }
            catch
            {
                MessageBox.Show("목록을 가져오는데 실패했습니다.");
            }

            nextPageButton.IsEnabled = true;
            LoadingArticleListProgressBar.IsIndeterminate = false;
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ISite  dcinside = new DCInsideSite();
            IBoard board    = dcinside.GetBoard("windowsphone", "윈도우폰");

            ILister <IArticle> articles = board.GetArticleLister(0);

            var cts = new CancellationTokenSource();
            IEnumerable <IArticle> result;

            if (articles.Next(cts.Token, out result))
            {
                foreach (IArticle article in result)
                {
                    Console.WriteLine(article.Title);
                }
                // var article = result.ElementAt(2);
                // article.WriteComment("b", cts.Token);
            }
        }