internal async void CreateMarker(ViewMapTrip mapPage, MapUIElementCollection _element) { if (MarkerAlbum != null) { MarkerAlbum.Delete(); } StorageFile _file; try { if (Summary.Sample) { _file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///appdata/" + Summary.PathThumb + "/" + Summary.PicturesThumb[0])); } else { StorageFolder folder = await ApplicationData.Current.LocalFolder.GetFolderAsync(Summary.PathThumb); _file = await folder.GetFileAsync("Small_" + Summary.PicturesThumb[0]); } Uri uri = new Uri(_file.Path, UriKind.RelativeOrAbsolute); BitmapImage bm = new BitmapImage() { UriSource = uri }; MarkerAlbum = new MarkerPosition(mapPage, _element, Id, bm, Position, true, 20); } catch (Exception e) { Debug.WriteLine(e.Message); return; } }
internal void CreateMarker(ViewMapTrip mapPage, MapUIElementCollection _element, int _count) { if (MarkerPicture != null) { MarkerPicture.Delete(); } MarkerPicture = new MarkerPosition(mapPage, _element, _count, EIcon.IconFlag, Position, true, 20); }
public void DisplayMarkers(ViewMapTrip _view, MapUIElementCollection _element) { foreach (Album _album in Albums) { if (_album.PositionPresent) { _album.RemoveMarkerPictures(); _album.CreateMarker(_view, _element); } } }
public MarkerPosition(FrameworkElement view, MapUIElementCollection _element, object _tag, object Icon, GpsLocation pos, Boolean _visible, int _size) { _location = pos; _viewParent = view; _image = new Image(); _icon = Icon; if (Icon is EIcon) { _albumIcon = (EIcon)Icon; _image.Source = ImageFromRelativePath(view, GetIconInactive(_albumIcon)); } else if (Icon is BitmapImage) { _image.Source = Icon as BitmapImage; } else if (Icon is String) { _image.Source = ImageFromRelativePath(view, Icon as String); } _elementUI = _element; try { _image.Width = _size; _image.Height = _size; _image.Tag = _tag; _image.Tapped += image_Tapped; MapLayer.SetPosition(_image, Gps.ConvertGpsToLoc(_location)); if (Icon is BitmapImage) { MapLayer.SetPositionAnchor(_image, GetOffsetImage(2)); } else { MapLayer.SetPositionAnchor(_image, GetOffsetImage(1)); } _elementUI.Add(_image); #if DEBUG if (_tag != null) { _legend = new TextBlock(); if (_tag is Country) { _legend.Text = (_tag as Country).Name.ToString(); } else { _legend.Text = _tag.ToString(); } _legend.Foreground = new SolidColorBrush(Windows.UI.Colors.White); MapLayer.SetPosition(_legend, Gps.ConvertGpsToLoc(_location)); MapLayer.SetPositionAnchor(_legend, GetOffsetLegend()); _elementUI.Add(_legend); } #else _legend = null; #endif if (!_visible) { Hide(); } else { Show(); } } catch (Exception e) { Debug.WriteLine(e.Message); } }