private void AddMediaToFloatingElements(MapPoint tapPos)
{
if (Poi.AllMedia == null) return;
Vector offset;
var startPosition = ComputeStartPositionAndOffset(tapPos, out offset);
foreach (var m in Poi.AllMedia)
{
var imageFile = Path.GetFileName(m.Id);
var title = string.IsNullOrEmpty(Poi.Name)
? imageFile
: Poi.Name + " - " + imageFile;
if (AppState.FloatingItems.Any(f => string.Equals(f.Title, title)))
continue; // Do not add the same photo twice.
if (m.Type != MediaType.Photo) continue;
if (string.IsNullOrEmpty(m.LocalPath))
m.LocalPath = Poi.Service.store.GetLocalUrl(Poi.Service.MediaFolder, m.Id);
var d = new Document { Location = m.LocalPath, OriginalUrl = m.PublicUrl };
var fed = FloatingHelpers.CreateFloatingElement(d);
fed.Title = title;
fed.CanFullScreen = true;
fed.StartPosition = startPosition + offset;
offset += new Vector(10, 25);
AppState.FloatingItems.AddFloatingElement(fed);
}
}