FetchHabitatLocation() public static method

public static FetchHabitatLocation ( string term ) : double>>.Task
term string
return double>>.Task
コード例 #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var pager = new ViewPager(inflater.Context)
            {
                Id      = 0x34532,
                Adapter = new MonkeyPageAdapter(ChildFragmentManager),
            };

            pager.PageSelected += async(sender, e) => {
                var map        = (SupportMapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
                var monkeyName = ((MonkeyPageAdapter)pager.Adapter).GetMonkeyAtPosition(e.Position);
                var location   = await WikipediaApi.FetchHabitatLocation(monkeyName);

                var latLng = new Android.Gms.Maps.Model.LatLng(location.Item1, location.Item2);
                map.Map.AnimateCamera(CameraUpdateFactory.NewLatLng(latLng), 250, null);
                if (existingMarker != null)
                {
                    existingMarker.Remove();
                }
                existingMarker = map.Map.AddMarker(new MarkerOptions().SetPosition(latLng));
            };

            return(pager);
        }