Exemplo n.º 1
0
        public static void FillVideoProperties(PropertiesFlyoutVideo flyout, VideoProperties videoProps)
        {
            try
            {
                if (!string.IsNullOrEmpty(videoProps.Title))
                    flyout.VideoTitle.Text = videoProps.Title;
                else if (!string.IsNullOrEmpty(videoProps.Subtitle))
                    flyout.VideoTitle.Text = videoProps.Subtitle;
                else
                    flyout.HideVideoTitle();

                if (videoProps.Duration.TotalSeconds > 0)
                    flyout.Duration.Text = TimeSpan_ToString(videoProps.Duration);
                else
                    flyout.HideDuration();

                if (videoProps.Directors.Count >= 1)
                    flyout.Directors.Text += NameCreditsStr("", videoProps.Directors);
                else
                    flyout.HideDirectors();

                if (videoProps.Writers.Count >= 1)
                    flyout.Writers.Text = NameCreditsStr("", videoProps.Writers);
                else
                    flyout.HideWriters();

                if (videoProps.Producers.Count >= 1)
                    flyout.Producers.Text = NameCreditsStr("", videoProps.Producers);
                else
                    flyout.HideProducers();

                if (!string.IsNullOrEmpty(videoProps.Publisher))
                    flyout.Publisher.Text = videoProps.Publisher;
                else
                    flyout.HidePublisher();

                if (videoProps.Width > 0 && videoProps.Height > 0)
                    flyout.Dimensions.Text = videoProps.Width.ToString() + " x " + videoProps.Height.ToString() + " pixels";
                else
                    flyout.HideDimensions();

                if (videoProps.Year > 0)
                    flyout.Year.Text = videoProps.Year.ToString();
                else
                    flyout.HideYear();

                if (videoProps.Rating > 0)
                {
                    uint starRating = (videoProps.Rating == 0) ? 0 : (uint)Math.Round((double)videoProps.Rating / 25.0) + 1;
                    flyout.Rating.Text = starRating.ToString() + "*";
                }
                else
                    flyout.HideRating();

                if (videoProps.Bitrate > 0)
                    flyout.Bitrate.Text = Util.NumberToString(videoProps.Bitrate, "bps");
                else
                    flyout.HideBitrate();

                if (videoProps.Keywords.Count >= 1)
                    flyout.Keywords.Text = NameCreditsStr("", videoProps.Keywords);
                else
                    flyout.HideKeywords();

                // IMPORTANT: Need GeoCoordinate class from System.Device.Location namespace (but not avail on WinRT);
                // Not suitable: Windows.Devices.Geolocation namespace;
                // GeoCoordinate geoCoord = new GeoCoordinate();
                if (videoProps.Latitude.HasValue)
                    flyout.Latitude.Text = Util.LatOrLong_ToString(videoProps.Latitude);
                else
                    flyout.HideLatitude();
                if (videoProps.Longitude.HasValue)
                    flyout.Longitude.Text = Util.LatOrLong_ToString(videoProps.Longitude);
                else
                    flyout.HideLongitude();
            }
            catch (Exception ex) { Debug.WriteLine(ex.ToString()); }
        }