public void AddPointItem(double latitude, double longitude, String imgPath, String title, string servPath, KoreaLocation location) { if (latitude > 100) { return; } BasicGeoposition snPosition = new BasicGeoposition() { Latitude = latitude, Longitude = longitude }; Geopoint snPoint = new Geopoint(snPosition); UserPOI item = new UserPOI(); item.SetItem(imgPath, title, servPath, location); // Create a XAML border. item.PointerReleased += Item_PointerReleased; // Center the map over the POI. //mc_MapControl.Center = snPoint; //mc_MapControl.ZoomLevel = 12; // Add XAML to the map. mc_MapControl.Children.Add(item); MapControl.SetLocation(item, snPoint); // MapControl.SetNormalizedAnchorPoint(item, new Point(0.5, 0.5)); }
private async void Item_PointerReleased(object sender, PointerRoutedEventArgs e) { if (sender is UserPOI) { UserPOI item = sender as UserPOI; _address = item.Tag as KoreaLocation; if (String.IsNullOrEmpty((item.Tag as KoreaLocation).FirstImage) == false) { BitmapImage img = new BitmapImage(); ImageBrush imgBr = new ImageBrush(); img.UriSource = new Uri((item.Tag as KoreaLocation).FirstImage); imgBr.ImageSource = img; imgBr.Stretch = Stretch.UniformToFill; img_IMage.Fill = imgBr; img_IMage.Visibility = Visibility.Visible; } else { img_IMage.Fill = null; img_IMage.Visibility = Visibility.Collapsed; } txt_Title.Text = (item.Tag as KoreaLocation).Title; dr_Info.SetData((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID); String data = await Request_Json((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID); ParseAreaJson(data); String data2 = await Request_Images_Json((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID); ParseImagesJson(data2); // SetLocation(Convert.ToDouble((item.Tag as KoreaLocation).MapY), Convert.ToDouble((item.Tag as KoreaLocation).MapX)); if ((item.Tag as KoreaLocation).ContentTypeID == "39" || (item.Tag as KoreaLocation).ContentTypeID == "82") { String data3 = await Request_FoodImages_Json((item.Tag as KoreaLocation).ContentID, (item.Tag as KoreaLocation).ContentTypeID); ParseFoodImagesJson(data3); } else { cd_Width.Width = new GridLength(0); st_Serv.Children.Clear(); } st_Festival.Children.Clear(); List <KoreaLocation> itemObject = MainPage._festivalList.Where(a => a.ContentID == (item.Tag as KoreaLocation).ContentID && a.ContentTypeID == (item.Tag as KoreaLocation).ContentTypeID).ToList(); if (itemObject != null && itemObject.Count() > 0) { tbtn_Festival.Visibility = Visibility.Visible; foreach (KoreaLocation itemin in itemObject) { FestivalControl festy = new FestivalControl(); festy.SetItem(itemin.FirstImage, itemin.EventStartDate , itemin.EventEndDate, itemin.Title); st_Festival.Children.Add(festy); } } else { tbtn_Festival.IsChecked = false; tbtn_Festival.Visibility = Visibility.Collapsed; } if (bd_InfoControl.Visibility == Visibility.Collapsed) { bd_InfoControl.Visibility = Visibility.Visible; } } }