private void SelectStop(StopInfo selectedStop) { var center = new CLLocationCoordinate2D(selectedStop.LatLon.Latitude, selectedStop.LatLon.Longtitude); var region = new MKCoordinateRegion(center, new MKCoordinateSpan(0.003, 0.003)); var marker = new BusStopMarker(selectedStop.StopName, center); BusStopMap.SetRegion(BusStopMap.RegionThatFits(region), true); if(BusStopMap.Annotations.Length > 0) { var annotation = (MKAnnotation)BusStopMap.Annotations[0]; BusStopMap.RemoveAnnotation(annotation); } BusStopMap.AddAnnotationObject(marker); BusStopCode.Text = selectedStop.StopName; }
private void ReadStopInfo() { Stops = new List<StopInfo>(); Debug.WriteLine("Exists? " + File.Exists(Path.Combine(Environment.CurrentDirectory, "Data/R1615.HPL"))); try { using (var fileStream = File.Open(Path.Combine(Environment.CurrentDirectory, "Data/R1615.HPL"), FileMode.Open, FileAccess.Read)) using (var reader = new StreamReader(fileStream)) { while (!reader.EndOfStream) { var line = reader.ReadLine(); var stopInfo = new StopInfo(line); Stops.Add(stopInfo); } } } catch(Exception ex) { Debug.WriteLine(ex.ToString()); throw; } }