protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.All); var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; double lat; double lng; try { var result = await locator.GetPositionAsync(timeoutMilliseconds : 10000); lat = result.Latitude; lng = result.Longitude; } catch (Exception) { lat = -31.9522; lng = 115.8589; } TrainStationService.SetDistance(lat, lng); var listView = FindViewById <ListView>(Resource.Id.List); listView.Adapter = new TrainStationAdapter(this, _trainStations); listView.ItemClick += OnListItemClick; }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); _id = Intent.GetStringExtra("id"); _station = _trainStations.Single(p => p.identifier == _id); // Set our view from the "main" layout resource SetContentView(Resource.Layout.All); try { var trains = await TrainStationService.GetTrainsForStation(_id); var listView = FindViewById <ListView>(Resource.Id.List); listView.Adapter = new TrainsAdapter(this, trains.ToArray()); } catch (Exception ex) { } }