예제 #1
0
        public async Task LoadMonkeys()
        {
            IsBusy = true;
            Monkeys.Clear();

            var dataManager = App.MonkeyDataManager;

            var monkeys = await dataManager.GetMonkeysAsync();
             
            foreach (var item in monkeys)
            {
         
                var imageFiles = await dataManager.GetImageFiles(item);
                // Display only the photo files
                if (imageFiles != null && imageFiles.Count() > 0)
                {
                    var monkeyVm = new MonkeyViewModel(item);
                    monkeyVm.PhotoUrl = fileHelper.GetLocalFilePath(
                             item.Id, imageFiles.First().Name);

                    Monkeys.Add(monkeyVm);
                }
                IsBusy = false;

            }

            //var collection = new ObservableCollection<MonkeyViewModel>();

            //collection.Add(new MonkeyViewModel(new Models.Monkey
            //{
            //    UserName = "******",
            //    Status = "Chilling out in Malaysia",
            //    PhotoUrl = "http://photos1.meetupstatic.com/photos/event/8/f/d/6/600_343476822.jpeg"
            //}));
            //collection.Add(new MonkeyViewModel(new Models.Monkey
            //{
            //    UserName = "******",
            //    Status = "Wooh! Got boxed",
            //    PhotoUrl = "http://photos1.meetupstatic.com/photos/event/8/f/d/6/600_343476822.jpeg"
            //}));

            // monkeys = collection;
        }
예제 #2
0
        public async Task LoadMonkeys()
        {
            IsBusy = true;
            Monkeys.Clear();

            var dataManager = App.MonkeyDataManager;

            var monkeys = await dataManager.GetMonkeysAsync();

            foreach (var item in monkeys)
            {
                var imageFiles = await dataManager.GetImageFiles(item);

                // Display only the photo files
                if (imageFiles != null && imageFiles.Count() > 0)
                {
                    var monkeyVm = new MonkeyViewModel(item);
                    monkeyVm.PhotoUrl = fileHelper.GetLocalFilePath(
                        item.Id, imageFiles.First().Name);

                    Monkeys.Add(monkeyVm);
                }
                IsBusy = false;
            }

            //var collection = new ObservableCollection<MonkeyViewModel>();

            //collection.Add(new MonkeyViewModel(new Models.Monkey
            //{
            //    UserName = "******",
            //    Status = "Chilling out in Malaysia",
            //    PhotoUrl = "http://photos1.meetupstatic.com/photos/event/8/f/d/6/600_343476822.jpeg"
            //}));
            //collection.Add(new MonkeyViewModel(new Models.Monkey
            //{
            //    UserName = "******",
            //    Status = "Wooh! Got boxed",
            //    PhotoUrl = "http://photos1.meetupstatic.com/photos/event/8/f/d/6/600_343476822.jpeg"
            //}));

            // monkeys = collection;
        }