Exemplo n.º 1
0
        private string GetMaxResolution(ThumbnailDetails th)
        {
            if (th.Maxres != null)
            {
                return(th.Maxres.Url);
            }
            else if (th.High != null)
            {
                return(th.High.Url);
            }
            else if (th.Medium != null)
            {
                return(th.Medium.Url);
            }
            else if (th.Standard != null)
            {
                return(th.Standard.Url);
            }
            else if (th.Default__ != null)
            {
                return(th.Default__.Url);
            }

            return(null);
        }
Exemplo n.º 2
0
        public static string GetMaxResUrl(
            this ThumbnailDetails thumbnails)
        {
            string url = string.Empty;

            if (thumbnails.Maxres != null)
            {
                url = thumbnails.Maxres.Url;
            }
            else if (thumbnails.High != null)
            {
                url = thumbnails.High.Url;
            }
            else if (thumbnails.Medium != null)
            {
                url = thumbnails.Medium.Url;
            }
            else if (thumbnails.Standard != null)
            {
                url = thumbnails.Standard.Url;
            }
            else if (thumbnails.Default__ != null)
            {
                url = thumbnails.Default__.Url;
            }

            return(url);
        }
Exemplo n.º 3
0
        public string FindImageUrl(ThumbnailDetails details)
        {
            string res = "";

            if (details.Standard != null)
            {
                res = details.Standard.Url;
                return(res);
            }
            else if (details.Medium != null)
            {
                res = details.Medium.Url;
                return(res);
            }
            else if (details.High != null)
            {
                res = details.High.Url;
                return(res);
            }
            else if (details.Maxres != null)
            {
                res = details.Maxres.Url;
                return(res);
            }
            return(res);
        }
Exemplo n.º 4
0
 string GetThumbnailImg(ThumbnailDetails thumbnailDetails)
 {
     if (thumbnailDetails == null)
     {
         return(string.Empty);
     }
     return((thumbnailDetails.Medium ?? thumbnailDetails.Default__ ?? thumbnailDetails.High)?.Url);
 }
Exemplo n.º 5
0
 string GetMainImg(ThumbnailDetails thumbnailDetails)
 {
     if (thumbnailDetails == null)
     {
         return(string.Empty);
     }
     return((thumbnailDetails.Maxres ?? thumbnailDetails.Standard ?? thumbnailDetails.High)?.Url);
 }
Exemplo n.º 6
0
        private string PickThumbnail(ThumbnailDetails thumbnailDetails)
        {
            var thumbnail =
                thumbnailDetails.Medium ??
                thumbnailDetails.Default__;

            return(thumbnail?.Url);
        }
Exemplo n.º 7
0
 private Uri getPicture(ThumbnailDetails details)
 {
     //TODO: maybe fetch the biggest or what the user wants and not just the default.
     if (ShallFetchThumbnail)
     {
         return(new Uri(details.Default__.Url));
     }
     //sets a default image, since we shall not fetch it from the web.
     return(new Uri("/Media/NoAlbumArt.png", UriKind.RelativeOrAbsolute));
 }
Exemplo n.º 8
0
 private string GetVideoThumbnail(ThumbnailDetails thumb)
 {
     // Check if max res image is avaliable (not all videos have them)
     if (thumb.Maxres != null)
     {
         return(thumb.Maxres.Url); // Max Res
     }
     else // If not get next best thing
     {
         return(thumb.Medium.Url); // Medium Res
     }
 }
Exemplo n.º 9
0
        public MThumbnailDetails(ThumbnailDetails thumbnailDetails)
        {
            if (thumbnailDetails == null)
            {
                return;
            }

            _high     = new MThumbnail(thumbnailDetails.High);
            _maxres   = new MThumbnail(thumbnailDetails.Maxres);
            _medium   = new MThumbnail(thumbnailDetails.Medium);
            _standard = new MThumbnail(thumbnailDetails.Standard);
            _default  = new MThumbnail(thumbnailDetails.Default__);
        }
Exemplo n.º 10
0
 private Video GetTestVideo()
 {
     Video v = new Video() { Id = "id"};
     ThumbnailDetails thumbnails = new ThumbnailDetails() { Default__ = new Thumbnail() { Url = "TestCoverUrl" } };
     v.Snippet = new VideoSnippet()
     {
         Title = "TestTitle",
         Description = "TestDescription",
         PublishedAt = new DateTime(2013, 1, 23),
         Thumbnails = thumbnails,
     };
     v.Statistics = new VideoStatistics() { LikeCount = 20 };
     return v;
 }
Exemplo n.º 11
0
        public static string GetThumbnailUrl(ThumbnailDetails thumbnailDetails)
        {
            if (thumbnailDetails.Standard != null)
            {
                return(thumbnailDetails.Standard.Url);
            }
            else if (thumbnailDetails.Medium != null)
            {
                return(thumbnailDetails.Medium.Url);
            }
            else if (thumbnailDetails.High != null)
            {
                return(thumbnailDetails.High.Url);
            }

            return(null);
        }
Exemplo n.º 12
0
 private Uri GetUri(ThumbnailDetails thumbnails)
 {
     if (thumbnails.Maxres != null)
     {
         return(new Uri(thumbnails.Maxres.Url, UriKind.RelativeOrAbsolute));
     }
     else if (thumbnails.High != null)
     {
         return(new Uri(thumbnails.High.Url, UriKind.RelativeOrAbsolute));
     }
     else if (thumbnails.Medium != null)
     {
         return(new Uri(thumbnails.Medium.Url, UriKind.RelativeOrAbsolute));
     }
     else if (thumbnails.Default__ != null)
     {
         return(new Uri(thumbnails.Default__.Url, UriKind.RelativeOrAbsolute));
     }
     return(new Uri(string.Empty, UriKind.RelativeOrAbsolute));
 }
Exemplo n.º 13
0
        private string GetThumbNail(ThumbnailDetails t)
        {
            if (t.High != null)
            {
                return(t.High.Url);
            }
            if (t.Medium != null)
            {
                return(t.Medium.Url);
            }
            if (t.Standard != null)
            {
                return(t.Standard.Url);
            }
            if (t.Default__ != null)
            {
                return(t.Default__.Url);
            }

            return("");
        }
        public ActionResult Index()
        {
            // Tab Data
            ThumbnailViewModel model = new ThumbnailViewModel();

            model.ThumbnailModelList = new List <ThumbnailModel>();

            // Test Details Data
            List <ThumbnailDetails> _detaisllist = new List <ThumbnailDetails>();
            int count = 10;

            for (int i = 1; i <= count; i++)
            {
                ThumbnailDetails obj = new ThumbnailDetails();
                obj.Details1 = "Details- Main" + i;
                obj.Details2 = "Details- Main-Sub" + i;
                _detaisllist.Add(obj);
            }

            // batch your List data for tab view i want batch by 2 you can set your value

            var listOfBatches = _detaisllist.Batch(2);

            int tabNo = 1;

            foreach (var batchItem in listOfBatches)
            {
                // Generating tab
                ThumbnailModel obj = new ThumbnailModel();
                obj.ThumbnailLabel          = "Lebel" + tabNo;
                obj.ThumbnailTabId          = "tab" + tabNo;
                obj.ThumbnailTabNo          = tabNo;
                obj.Thumbnail_Aria_Controls = "tab" + tabNo;
                obj.Thumbnail_Href          = "#tab" + tabNo;

                // batch details

                obj.ThumbnailDetailsList = new List <ThumbnailDetails>();

                foreach (var item in batchItem)
                {
                    ThumbnailDetails detailsObj = new ThumbnailDetails();
                    detailsObj = item;
                    obj.ThumbnailDetailsList.Add(detailsObj);
                }

                model.ThumbnailModelList.Add(obj);

                tabNo++;
            }

            // Getting first tab data
            var first = model.ThumbnailModelList.FirstOrDefault();

            // Getting first tab data
            var last = model.ThumbnailModelList.LastOrDefault();

            foreach (var item in model.ThumbnailModelList)
            {
                if (item.ThumbnailTabNo == first.ThumbnailTabNo)
                {
                    item.Thumbnail_ItemPosition = "first";
                }

                if (item.ThumbnailTabNo == last.ThumbnailTabNo)
                {
                    item.Thumbnail_ItemPosition = "last";
                }
            }

            return(View(model));
        }
Exemplo n.º 15
0
        private ThumbnailData GetThumbnailUrl(ThumbnailDetails thumbnailDetails)
        {
            string url = null;
            Size size = new Size();

            if (thumbnailDetails != null)
            {
                if (thumbnailDetails.Standard != null)
                {
                    url = thumbnailDetails.Standard.Url;
                    size.Width = (int)thumbnailDetails.Standard.Width.Value;
                    size.Height = (int)thumbnailDetails.Standard.Height.Value;
                }
                else if (thumbnailDetails.High != null)
                {
                    url = thumbnailDetails.High.Url;
                    size.Width = (int)thumbnailDetails.High.Width.Value;
                    size.Height = (int)thumbnailDetails.High.Height.Value;
                }
                else if (thumbnailDetails.Medium != null)
                {
                    url = thumbnailDetails.Medium.Url;
                    size.Width = (int)thumbnailDetails.Medium.Width.Value;
                    size.Height = (int)thumbnailDetails.Medium.Height.Value;
                }
            }

            return new ThumbnailData { Url = url, Size = size };
        }
Exemplo n.º 16
0
 private string GetVideoThumbnail(ThumbnailDetails thumb)
 {
     // Check if max res image is avaliable (not all videos have them)
     if (thumb.Maxres != null)
         return thumb.Maxres.Url; // Max Res
     else // If not get next best thing
         return thumb.Medium.Url; // Medium Res
 }
Exemplo n.º 17
0
 private string TakeBestQualityThumbnail(ThumbnailDetails thumbnail)
 => thumbnail.Maxres?.Url
 ?? thumbnail.Standard?.Url
 ?? thumbnail.High?.Url
 ?? thumbnail.Medium?.Url
 ?? thumbnail.Default__?.Url;