async Task ExecuteLoadBirdsCommand() { if (IsBusy) { return; } IsBusy = true; try { KnownBirds.Clear(); var _birds = await BirdService.GetKnownBirdsAsync(); foreach (var tmpBird in _birds) { KnownBird tmpKB = new KnownBird(); tmpKB.BirdID = tmpBird.BirdID; tmpKB.Name = tmpBird.Name; tmpKB.examplePicture = tmpBird.examplePicture; tmpKB.displayName = tmpBird.displayName; //Change this to URL when setting this from the REST API and not the local data. //tmpKB.BirdImage = ImageSource.FromResource("BirdWatcherMobileApp.SampleData.images." + tmpBird.examplePicture); tmpKB.BirdImage = new UriImageSource { CachingEnabled = false, Uri = new Uri("http://" + Settings.ServerAddress + "/images/bird_examples/" + tmpBird.examplePicture) }; KnownBirds.Add(tmpKB); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public async void OnItemTapped(object sender, ItemTappedEventArgs args, INavigation myNav) { KnownBird selectedBird = args.Item as KnownBird; await myNav.PushAsync(new KnownBirdDetailPage(new KnownBirdDetailPageViewModel(selectedBird))); }