AppCompat.WikipediaApi.FetchHabitatLocation C# (CSharp) Method

FetchHabitatLocation() public static method

public static FetchHabitatLocation ( string term ) : double>>.Task
term string
return double>>.Task
		public static Task<Tuple<double, double>> FetchHabitatLocation (string term)
		{
			var loc = Locations [((int)term[0]) % Locations.Length];
			return Task.FromResult (loc);
		}
	}

Usage Example

        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);
        }