示例#1
0
        public void processNodeData(JObject node)
        {
            //Debug.Print(node.ToString());

            m_Command = new Command();
            //set up default sizes for images
            Size movie_size = new Size(188, 250);
            Size tv_size    = new Size(334, 250);

            processFormatNodes(node);

            m_Title             = (string)node["title"];
            m_Synopsis          = (string)node["synopsis"];
            amazonRating        = new AmazonRating();
            amazonRating.Count  = (int)node["amazonRating"]["count"];
            amazonRating.Rating = (float)node["amazonRating"]["rating"];
            starsRatingImage    = (amazonRating.Rating % 1 == 0) ? starsFullImage : starsHalfImage;
            m_RegulatoryRating  = (string)node["regulatoryRating"];
            m_trailerAvailable  = (bool)node["trailerAvailable"];
            m_contentType       = (string)node["contentType"];
            JObject runtime = (JObject)node["runtime"];

            m_runtime = "";
            if (runtime != null)
            {
                if (runtime["valueFormatted"] != null)
                {
                    m_runtime = (string)node["runtime"]["valueFormatted"];
                }
            }
            JObject releaseOrFirstAiringDate = (JObject)node["releaseOrFirstAiringDate"];

            if (releaseOrFirstAiringDate != null)
            {
                if (releaseOrFirstAiringDate["valueFormatted"] != null)
                {
                    m_firstAiringDate = (DateTime)node["releaseOrFirstAiringDate"]["valueFormatted"];
                }
            }
            switch (m_contentType)
            {
            case "MOVIE":
                size = movie_size;
                break;

            case "SEASON":
                size = tv_size;
                string childquery = (string)node["childTitles"][0]["feedUrl"];
                if (childquery.IndexOf("?") > 0)
                {
                    //this must be a browse query, and therefore contains the full url but without the device keys.
                    //need to replace the prefix and use the querystring.
                    m_ChildTitleQuery = AmazonVideoRequest.generateUrl("catalog/Browse") + "&" + childquery.Split('?')[1];
                }
                else
                {
                    //this must have come from a search query.
                    m_ChildTitleQuery = AmazonVideoRequest.generateUrl("catalog/Browse") + "&" + childquery + "&version=2";
                }
                break;

            //So far, I have not yet seen Series or Episode, but I know they are options, so when we find one, we
            //will need to address it.
            case "SERIES":
                size = tv_size;
                m_ChildTitleQuery = (string)node["childTitles"][0]["feedUrl"];
                break;

            case "EPISODE":
                size = tv_size;
                break;
            }

            m_ASIN = (string)node["titleId"];

            //todo: fix this to work properly with the right image url
            //m_ImageUrl =(string)node["formats"][selectedFormat]["images"][1]["uri"];;
            //m_Image = new Image(m_ImageURL);
            m_Price = "Free!";
            FirePropertyChanged("size");
            FirePropertyChanged("Title");
            FirePropertyChanged("Synopsis");
        }