private void AddLandmark_Click(object sender, RoutedEventArgs e) { if (_pointDataViewCreate == null) { _pointDataViewCreate = new PointDataViewCreate(); _pointDataViewCreate.Summary = Service.Summaries; _pointDataViewCreate.User = Service.User; _pointDataViewCreate.MainPage = this; // HACK for callback } else if (_pointDataViewCreate.Pin != null) { userGenMapLayer.Children.Remove(_pointDataViewCreate.Pin); _pointDataViewCreate.Pin = null; _pointDataViewCreate.createViewBox.ClearForm(); userGenMapLayer.Children.Remove(_pointDataViewCreate); } // Hide the current landmark data view _pointDataView.Visibility = Visibility.Collapsed; Pushpin customPin = new Pushpin(); customPin.Location = OpenDataMap.Center; _pointDataViewCreate.Pin = customPin; userGenMapLayer.AddChild(_pointDataViewCreate, OpenDataMap.Center,PositionOrigin.BottomCenter); customPin.Background = new SolidColorBrush(Color.FromArgb(255, 0x40, 0x22, 0x5F));////40225F userGenMapLayer.Visibility = Visibility.Visible; userGenMapLayer.Children.Add(customPin); _pointDataViewCreate.Visibility = Visibility.Visible; customPin.MouseLeftButtonDown += customPin_MouseLeftButtonDown; customPin.MouseLeftButtonUp += customPin_MouseLeftButtonUp; }
public void EditLandmark(PlaceMark pm) { if (_pointDataViewCreate == null) { _pointDataViewCreate = new PointDataViewCreate(); _pointDataViewCreate.Summary = Service.Summaries; _pointDataViewCreate.User = Service.User; _pointDataViewCreate.MainPage = this; // HACK for callback } else { if (_pointDataViewCreate.Pin != null) { userGenMapLayer.Children.Remove(_pointDataViewCreate.Pin); _pointDataViewCreate.Pin = null; } userGenMapLayer.Children.Remove(_pointDataViewCreate); } _pointDataView.Visibility = Visibility.Collapsed; _pointDataViewCreate.createViewBox.ClearForm(); _pointDataViewCreate.createViewBox.Data = pm.Summary; Pushpin customPin = new Pushpin(); customPin.Location = new Location(_pointDataView.CurrentSummary.Latitude, _pointDataView.CurrentSummary.Longitude); _pointDataViewCreate.Pin = customPin; userGenMapLayer.AddChild(_pointDataViewCreate, customPin.Location, PositionOrigin.BottomCenter); customPin.Background = new SolidColorBrush(Color.FromArgb(255, 0x40, 0x22, 0x5F));////40225F userGenMapLayer.Visibility = Visibility.Visible; userGenMapLayer.Children.Add(customPin); _pointDataViewCreate.Visibility = Visibility.Visible; customPin.MouseLeftButtonDown += new MouseButtonEventHandler(customPin_MouseLeftButtonDown); customPin.MouseLeftButtonUp += new MouseButtonEventHandler(customPin_MouseLeftButtonUp); }