Ejemplo n.º 1
0
        private static void CreateVerticalSlides(string resource, bool haveScores)
        {
            var verticals = photos.Values.Where(p => !p.horizontal).OrderByDescending(p => p.tags.Count).Select(p => p).ToList();

            while (verticals.Count >= 2)
            {
                var p1 = verticals.First();
                verticals.Remove(p1);

                var candidates = verticals.Select(p => new { photo = p, count = p.tags.Intersect(p1.tags).Count() })
                                 .OrderBy(x => x.count)
                                 .ThenBy(x => x.photo.Weight(slideShow))
                                 .Take(1).ToList();

                //var candidates = verticals.Select(p => new { photo = p, count = p.tags.Intersect(p1.tags).Count() })
                //.OrderBy(x => x.count)
                //.Take(1).ToList();

                var p2 = candidates.First().photo;
                verticals.Remove(p2);
                Slide slide = slideShow.AddPhotos(p1, p2);
                Console.Write(string.Format("Preparing vertical slides - remaining {0}\t\t\t\r", verticals.Count));
            }
        }