public MapPage(iATM i_ATM = null) { setupPins(); Map map = new Map() { HasZoomEnabled = true, IsShowingUser = true, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; map.MoveToRegion((MapSpan.FromCenterAndRadius((IDistance.position != null) ? new Position(IDistance.position.Latitude, IDistance.position.Longitude) : new Position(44.536049, 18.679751), Distance.FromKilometers(1)))); InitializeComponent(); if (i_ATM != null) { atmName.Text = i_ATM.name; atmAddress.Text = i_ATM.address; setURL(i_ATM.name, new Position(i_ATM.latitude, i_ATM.longtitude)); } else { atmInfo.IsVisible = false; } if (Device.OS == TargetPlatform.Android) { mapLayout.Children.Remove(atmInfo); } mapLayout.Children.Add(map); setPins(allPins, map); //map.PropertyChanging += mapChanging; }
public static iATM Shortest() { iATM closestATM = new iATM(); if (position != null) { int distance, temp; distance = Between(position, atms[0].gpsy, atms[0].gpsx); closestATM = new iATM(atms[0], distance); foreach (ATM atm in atms) { temp = Between(position, atm.gpsy, atm.gpsx); if (temp < distance) { distance = temp; closestATM = new iATM(atm, distance); } } } return(closestATM); }