コード例 #1
0
        /// <summary>
        /// Gets the photo details for the given photo id.
        /// </summary>
        /// <param name="photoId">The photo identifier.</param>
        /// <returns>The photo.</returns>
        public async Task <Photo> GetPhotoDetails(string photoId)
        {
            await SimulateWaitAndError();

            var photo = PhotoStreams.SelectMany(s => s.Photos)
                        .FirstOrDefault(p => p.Id == photoId);

            photo.Annotations = new ObservableCollection <Annotation>(Annotations);

            return(photo);
        }
コード例 #2
0
        private void InitLeaderboardData()
        {
            var allPhotos = PhotoStreams.SelectMany(s => s.Photos).ToList();
            var users     = _sampleUsers;

            var leaderboard = new Leaderboard
            {
                MostGoldCategories = new List <LeaderboardEntry <Category> >
                {
                    new LeaderboardEntry <Category>
                    {
                        Model = Categories[_random.Next(Categories.Count)],
                        Rank  = 1,
                        Value = 94
                    },
                    new LeaderboardEntry <Category>
                    {
                        Model = Categories[_random.Next(Categories.Count)],
                        Rank  = 2,
                        Value = 79
                    },
                    new LeaderboardEntry <Category>
                    {
                        Model = Categories[_random.Next(Categories.Count)],
                        Rank  = 3,
                        Value = 47
                    }
                },
                MostGoldPhotos = new List <LeaderboardEntry <Photo> >
                {
                    new LeaderboardEntry <Photo>
                    {
                        Model = allPhotos[_random.Next(allPhotos.Count)],
                        Rank  = 1,
                        Value = 38
                    },
                    new LeaderboardEntry <Photo>
                    {
                        Model = allPhotos[_random.Next(allPhotos.Count)],
                        Rank  = 2,
                        Value = 29
                    },
                    new LeaderboardEntry <Photo>
                    {
                        Model = allPhotos[_random.Next(allPhotos.Count)],
                        Rank  = 3,
                        Value = 21
                    }
                },
                MostGoldUsers = new List <LeaderboardEntry <User> >
                {
                    new LeaderboardEntry <User>
                    {
                        Model = users[_random.Next(users.Count)],
                        Rank  = 1,
                        Value = 68
                    },
                    new LeaderboardEntry <User>
                    {
                        Model = users[_random.Next(users.Count)],
                        Rank  = 2,
                        Value = 54
                    },
                    new LeaderboardEntry <User>
                    {
                        Model = users[_random.Next(users.Count)],
                        Rank  = 3,
                        Value = 37
                    }
                },
                MostGivingUsers = new List <LeaderboardEntry <User> >
                {
                    new LeaderboardEntry <User>
                    {
                        Model = users[_random.Next(users.Count)],
                        Rank  = 1,
                        Value = 34
                    },
                    new LeaderboardEntry <User>
                    {
                        Model = users[_random.Next(users.Count)],
                        Rank  = 2,
                        Value = 27
                    },
                    new LeaderboardEntry <User>
                    {
                        Model = users[_random.Next(users.Count)],
                        Rank  = 3,
                        Value = 17
                    }
                }
            };

            LeaderboardData = leaderboard;
        }