Ejemplo n.º 1
0
        /// <summary>
        /// 現在のトレンドを取得する
        /// </summary>
        private async void SetTrends()
        {
            this.ExtraGrid.Clear();
            this.ExtraGrid.Add(new Grid());

            var trendResult = await AccountTokens.LoadTrendsAsync(this.TokenSuffix);

            var itemsSource = new List <TrendProperties>();

            var i = 1;

            foreach (var trends in trendResult)
            {
                foreach (var trend in trends)
                {
                    var item = new TrendProperties(this)
                    {
                        Rank     = i,
                        Name     = trend.Name,
                        HasCount = trend.TweetVolume != null
                    };
                    if (trend.TweetVolume != null)
                    {
                        item.Count = (int)trend.TweetVolume;
                    }
                    itemsSource.Add(item);
                    i++;
                }
            }

            this.ExtraGrid.First().Children.Add(
                new Views.MainWindows.Flyouts.ExtraGrid.Trends()
            {
                DataContext = new TrendsModel(this, itemsSource)
            }
                );
        }