private void _WireDesignerData()
        {
            if (!DesignerProperties.IsInDesignTool) return;

            NearbyChallenges = new ChallengeViewModel();
            NewChallenges = new ChallengeViewModel();
            TopChallenges = new ChallengeViewModel();
        }
        private void _WireDesignerData()
        {
            if (!DesignerProperties.IsInDesignTool)
            {
                return;
            }

            NearbyChallenges = new ChallengeViewModel();
            NewChallenges    = new ChallengeViewModel();
            TopChallenges    = new ChallengeViewModel();
        }
        /// <summary>
        /// Begins loading new challenges asynchronously.
        /// </summary>
        /// <param name="skipCount">The number of challenges to skip.</param>
        /// <returns>An awaitable task.</returns>
        protected async override Task LoadDataImpl(bool forceReload = false)
        {
            var geoposition = await Utilities.GeoLocationHelper.GetLocation();
            var geoPoint = new ParseGeoPoint(geoposition.Coordinate.Latitude, geoposition.Coordinate.Longitude);
            var query = ParseObject.GetQuery("Challenge");
            query.WhereNear("location", geoPoint).Limit(20).Skip(CurrentlyLoaded);

            List<Task> challengeTasks = new List<Task>();
            foreach (var challenge in await query.FindAsync())
            {
                var challengeViewModel = new ChallengeViewModel(challenge);
                Challenges.Add(challengeViewModel);
                challengeTasks.Add(challengeViewModel.LoadData());
            }
            await Task.WhenAll(challengeTasks.ToArray());

            CurrentlyLoaded += 20;
        }
Esempio n. 4
0
        /// <summary>
        /// Begins loading new challenges asynchronously.
        /// </summary>
        /// <param name="skipCount">The number of challenges to skip.</param>
        /// <returns>An awaitable task.</returns>
        protected async override Task LoadDataImpl(bool forceReload = false)
        {
            var geoposition = await Utilities.GeoLocationHelper.GetLocation();

            var geoPoint = new ParseGeoPoint(geoposition.Coordinate.Latitude, geoposition.Coordinate.Longitude);
            var query    = ParseObject.GetQuery("Challenge");

            query.WhereNear("location", geoPoint).Limit(20).Skip(CurrentlyLoaded);

            List <Task> challengeTasks = new List <Task>();

            foreach (var challenge in await query.FindAsync())
            {
                var challengeViewModel = new ChallengeViewModel(challenge);
                Challenges.Add(challengeViewModel);
                challengeTasks.Add(challengeViewModel.LoadData());
            }
            await Task.WhenAll(challengeTasks.ToArray());

            CurrentlyLoaded += 20;
        }