public void SetLocation(CLLocation newLocation, string title, string description)
		{
			if(_mapview.Annotations.Contains(CurrentAnnotation))
			{
				_mapview.RemoveAnnotation(CurrentAnnotation);	
			}
	        MKCoordinateSpan span = new MKCoordinateSpan(0.010, 0.010);
	        MKCoordinateRegion region = new MKCoordinateRegion(newLocation.Coordinate, span);
	        
	        _mapview.SetRegion(region, true);
			
			if(CurrentAnnotation == null)
				CurrentAnnotation = new MyAnnotation(new CLLocationCoordinate2D(newLocation.Coordinate.Latitude, 
				                                                            newLocation.Coordinate.Longitude), 
											                                 title, 
											                                 description);
			else
			{
				CurrentAnnotation.Coordinate = newLocation.Coordinate;
			}
			_mapview.AddAnnotation(CurrentAnnotation);
			_mapview.SelectAnnotation(CurrentAnnotation, false);
		}
Exemplo n.º 2
0
		protected void AddLocation(Logg logg)
		{
			if(Filter != "")
			{
				if(Filter == "Treff" && logg.Treff == 0)
					return;
				if(Filter == "Bom" && (logg.Skudd == 0 || logg.Treff > 0))
					return;
				if(Filter == "Obs" && (logg.Sett == 0 || logg.Skudd > 0 || logg.Treff > 0))
					return;
			}
			var id = logg.ID;
			var lat = double.Parse(logg.Latitude);
			var lon = double.Parse(logg.Longitude);
			var title = logg.Dato.ToNorwegianDateString() + " kl." +logg.Dato.ToNorwegianTimeString();
			var description = GetPinDescription(logg);
			
			var a = new MyAnnotation(new CLLocationCoordinate2D(lat,lon), title, description);
			a.CurrentLogg = logg;
			Pins.Add(id, a);
			mapView.AddAnnotation(a);
		}