private void addLocationToMap() { myMap = map; GeoCoordinate myGeocoordinate = new GeoCoordinate(latitude, longitude); myMap.Center = myGeocoordinate; myMap.ZoomLevel = 14; Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Red); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0, 1); myLocationOverlay.GeoCoordinate = myGeocoordinate; MapLayer myLocationLayer = new MapLayer(); myLocationLayer.Add(myLocationOverlay); myMap.Layers.Add(myLocationLayer); }
private void Geowach_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e) { map.Layers.Clear(); Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; MapOverlay myLocationOverlay = new MapOverlay(); myLocationOverlay.Content = myCircle; myLocationOverlay.PositionOrigin = new Point(0.5, 0.5); myLocationOverlay.GeoCoordinate = e.Position.Location; Microsoft.Phone.Maps.Controls.MapLayer myLocationLayer = new Microsoft.Phone.Maps.Controls.MapLayer(); myLocationLayer.Add(myLocationOverlay); map.Layers.Add(myLocationLayer); map.Center = e.Position.Location; map.SetView(e.Position.Location, 18, MapAnimationKind.Linear); //map.SetView(e.Position.Location, 18); }
private void MyGeocodeQuery_QueryCompleted(object sender, QueryCompletedEventArgs <IList <MapLocation> > e) { if (e.Error == null) { Ellipse myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; MapOverlay mo = new MapOverlay(); mo.Content = myCircle; mo.PositionOrigin = new Point(0.5, 0.5); mo.GeoCoordinate = g; Microsoft.Phone.Maps.Controls.MapLayer ml = new Microsoft.Phone.Maps.Controls.MapLayer(); ml.Add(mo); map.Layers.Add(ml); p_text.Text = String.Format("City: {0},\n Street: {1},\n House number: {2}", e.Result[0].Information.Address.City, e.Result[0].Information.Address.Street, e.Result[0].Information.Address.HouseNumber); myPopup.IsOpen = true; Duration duration = new Duration(TimeSpan.FromSeconds(2)); // Create two DoubleAnimations and set their properties. DoubleAnimation myDoubleAnimation1 = new DoubleAnimation(); DoubleAnimation myDoubleAnimation2 = new DoubleAnimation(); myDoubleAnimation1.Duration = duration; myDoubleAnimation2.Duration = duration; Storyboard sb = new Storyboard(); sb.Duration = duration; sb.Children.Add(myDoubleAnimation1); sb.Children.Add(myDoubleAnimation2); Storyboard.SetTarget(myDoubleAnimation1, po_stack); Storyboard.SetTarget(myDoubleAnimation2, po_stack); // Set the attached properties of Canvas.Left and Canvas.Top // to be the target properties of the two respective DoubleAnimations. Storyboard.SetTargetProperty(myDoubleAnimation1, new PropertyPath("(Canvas.Left)")); Storyboard.SetTargetProperty(myDoubleAnimation2, new PropertyPath("(Canvas.Top)")); myDoubleAnimation1.To = 200; myDoubleAnimation2.To = 200; // Make the Storyboard a resource. po_stack.Resources.Add("unique_id", sb); // Begin the animation. sb.Begin(); } }
private void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e) { map1.Center = new GeoCoordinate(39.766276, -86.164895); map1.ZoomLevel = 2; Microsoft.Phone.Maps.Controls.MapLayer layer = new Microsoft.Phone.Maps.Controls.MapLayer(); SolidColorBrush backColor = new SolidColorBrush(currentAccentColorHex); Pushpin a = new Pushpin(); a.Background = backColor; Pushpin b = new Pushpin(); Pushpin c = new Pushpin(); c.Background = backColor; Pushpin d = new Pushpin(); Pushpin f = new Pushpin(); f.Background = backColor; Pushpin g = new Pushpin(); a.Content = "FIGHT LIKE A GIRL!"; a.Location = new GeoCoordinate(34.117241, -117.733572); a.Tap += a_Tap; b.Content = "Smart Girl Summit 2013"; b.Location = new GeoCoordinate(39.766276, -86.164895); b.Tap += b_Tap; c.Content = "Women In Networking Meeting"; c.Location = new GeoCoordinate(33.759919, -118.116613); c.Tap += C_Tap; d.Content = "Return to Work - How and Why it is a Win-Wins - Webinar By MentorHealth"; d.Location = new GeoCoordinate(33.759919, -118.116613); d.Tap += d_Tap; //layer.AddChild(a, a.Location); //layer.AddChild(b, b.Location); //layer.AddChild(c, c.Location); //layer.AddChild(d, d.Location); //MapOverlay mo = new MapOverlay(); //mo.Content = a; //mo.Content = b; //mo.Content = c; //mo.Content = d; map1.Children.Add(a); map1.Children.Add(b); map1.Children.Add(c); map1.Children.Add(d); if (e.Position.Location.IsUnknown) { MessageBox.Show("Please wait while your position is determined...."); return; } }
private void FightNCourses_Loaded(object sender, RoutedEventArgs e) { Microsoft.Phone.Maps.Controls.MapLayer layer = new Microsoft.Phone.Maps.Controls.MapLayer(); Pushpin a = new Pushpin(); Pushpin b = new Pushpin(); Pushpin c = new Pushpin(); Pushpin d = new Pushpin(); Pushpin f = new Pushpin(); Pushpin g = new Pushpin(); a.Content = "FIGHT LIKE A GIRL!"; a.Location = new GeoCoordinate(34.117241, -117.733572); a.Tap += a_Tap; b.Content = "Smart Girl Summit 2013"; b.Location = new GeoCoordinate(39.766276, -86.164895); b.Tap += b_Tap; c.Content = "Women In Networking Meeting"; c.Location = new GeoCoordinate(33.759919, -118.116613); c.Tap += C_Tap; d.Content = "Return to Work - How and Why it is a Win-Wins - Webinar By MentorHealth"; d.Location = new GeoCoordinate(33.759919, -118.116613); d.Tap += d_Tap; //layer.AddChild(a, a.Location); //layer.AddChild(b, b.Location); //layer.AddChild(c, c.Location); //layer.AddChild(d, d.Location); //MapOverlay mo = new MapOverlay(); //mo.Content = a; //mo.Content = b; //mo.Content = c; //mo.Content = d; map1.Children.Add(a); map1.Children.Add(b); map1.Children.Add(c); map1.Children.Add(d); }
private void getBusStops(IAsyncResult result) { HttpWebRequest request = (HttpWebRequest)result.AsyncState; HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); using (StreamReader streamReader = new StreamReader(response.GetResponseStream())) { string jsonString = streamReader.ReadToEnd(); System.Diagnostics.Debug.WriteLine(jsonString); JObject jsonObject = JObject.Parse(jsonString); JArray jsonArray = (JArray)jsonObject["busstops"]; Dispatcher.BeginInvoke(() => { MapLayer myLocationLayer = new MapLayer(); Ellipse myCircle; MapOverlay[] busStopsOverlay = new MapOverlay[jsonArray.Count]; int i = 0; foreach (JObject busStop in jsonArray) { GeoCoordinate busStopCoordinates = new GeoCoordinate((double)busStop["GPS_Latitude"], (double)busStop["GPS_Longitude"]); myCircle = new Ellipse(); myCircle.Fill = new SolidColorBrush(Colors.Blue); myCircle.Height = 20; myCircle.Width = 20; myCircle.Opacity = 50; busStopsOverlay[i] = new MapOverlay(); busStopsOverlay[i].Content = myCircle; busStopsOverlay[i].PositionOrigin = new Point(0, 1); busStopsOverlay[i].GeoCoordinate = busStopCoordinates; myLocationLayer.Add(busStopsOverlay[i]); i++; } myMap.Layers.Add(myLocationLayer); }); } }
private void btn_address_Click(object sender, RoutedEventArgs e) { if (markerLayer != null) { map1.Layers.Remove(markerLayer); markerLayer = null; } markerLayer = new Microsoft.Phone.Maps.Controls.MapLayer(); map1.Layers.Add(markerLayer); if (geoQ.IsBusy == true) { geoQ.CancelAsync(); } // Set the full address query GeoCoordinate setMe = new GeoCoordinate(map1.Center.Latitude, map1.Center.Longitude); setMe.HorizontalAccuracy = 1000000; geoQ.GeoCoordinate = setMe; geoQ.SearchTerm = alamat_anakasuh.Text; Latitude = geoQ.GeoCoordinate.Latitude.ToString(); Longitude = geoQ.GeoCoordinate.Longitude.ToString(); //vrekomend.Latitude = this.Latitude; //vrekomend.Longitude = this.Longitude; Navigation.Latitude = this.Latitude.ToString(); Navigation.Longitude = this.Longitude.ToString(); geoQ.MaxResultCount = 200; geoQ.QueryAsync(); Debug.WriteLine("GeocodeAsync started for: " + alamat_anakasuh.Text); }