Пример #1
0
        /// <summary>
        /// Gets the achievements.
        /// </summary>
        /// <returns>
        /// Task
        /// </returns>
        public async Task <List <WaveEngine.Social.Achievement> > GetAchievements()
        {
            var achievements = await GKAchievement.LoadAchievementsAsync() ?? new GKAchievement[]
            {
            };
            var achievementsList = achievements.ToList();

            var waveAchievements = Mapper.MapAchievements(achievementsList);

            return(waveAchievements);
        }
Пример #2
0
        private async Task <GKAchievement> GetAchievementByCode(string achievementCode)
        {
            var achievements = await GKAchievement.LoadAchievementsAsync() ?? new GKAchievement[]
            {
            };
            var currentAchievement = achievements.FirstOrDefault(a => a.Identifier == achievementCode);

            if (currentAchievement == null)
            {
                throw new ArgumentException("achievementCode was not found");
            }

            return(currentAchievement);
        }
        /// <summary>
        /// Gets the achievements.
        /// </summary>
        /// <returns>
        /// The achievements.
        /// </returns>
        public Task <IEnumerable <Achievement> > GetAchievements()
        {
            var tcs = new TaskCompletionSource <IEnumerable <Achievement> >();

            UIKit.UIApplication.SharedApplication.InvokeOnMainThread(async() =>
            {
                var achievements     = await GKAchievement.LoadAchievementsAsync() ?? new GKAchievement[] { };
                var achievementsList = achievements.ToList();

                var result = await IOSMapper.MapAchievements(achievementsList);
                tcs.TrySetResult(result);
            });

            return(tcs.Task);
        }