Example #1
0
 //インスタンスの取得
 public static DetailsInformation GetInstace()
 {
     if (instance == null)
     {
         instance = new DetailsInformation();
     }
     return(instance);
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DetailsInformation detailsInformation = DetailsInformation.GetInstace();

            BitmapImage imageSource = new BitmapImage(new Uri("https://steamcdn-a.akamaihd.net/steam/apps/"
                                                              + detailsInformation.appid.ToString() + "/header.jpg"));

            imgHeder.Source = imageSource;

            tbTitle.Text = detailsInformation.name;

            Information information = Information.GetInstace();

            var consumerkey = information.stkey;
            var userid      = information.stid;
            var api         = new SteamApi(consumerkey, userid);
            var review      = api.GetReviewInfo(detailsInformation.appid);

            tbTotalReview.Text = review.query_summary.review_score_desc;
            tbPositive.Text    = review.query_summary.total_positive.ToString();
            tbNegative.Text    = review.query_summary.total_negative.ToString();
            tbTotal.Text       = review.query_summary.num_reviews.ToString();
            string voted;

            for (int i = 0; i < review.query_summary.num_reviews; i++)
            {
                if (review.reviews[i].voted_up == true)
                {
                    voted = "おすすめ";
                }
                else
                {
                    voted = "おすすめしない";
                }
                listView.Items.Add(new ReviewList
                {
                    Id         = review.reviews[i].author.steamid,
                    PlayTime   = review.reviews[i].author.playtime_forever / 60 + "時間",
                    ReviewTime = voted,
                });
            }
        }