/*Method designs a new pin and adds it to the Bing Map */ public Canvas DesignPin(FbPicInfo pic) { BitmapImage img = new BitmapImage(new Uri(pic.source, UriKind.Absolute)); ImageBrush imageBrush = new ImageBrush(); imageBrush.ImageSource = img; Color color = Colors.Silver; Canvas canvasPinDesign = NewCanvas();//creates a new canvas var location = CreateBasicGeoPosition(pic); if (_geoLocDict.ContainsValue(location))//if duplicate location in the dictonary geoLocDict change ellipse colour to red { color = Colors.OrangeRed; } Ellipse ellipse = NewEllipse(color, imageBrush); //Create a new elipse canvasPinDesign.Children.Add(ellipse); //Add Ellipse to Canvas Button btn = CreateNewBtn(imageBrush); //Create A New Button canvasPinDesign.Children.Add(btn); //Add Btn to Canvas _geoLocDict.Add(img, location); //add the location to the list _tempInfoDict.Add(img.UriSource, pic); return(canvasPinDesign); }
/*Method creates/returns a BasicGeoposition of lat/lon from the picture passed in. */ private BasicGeoposition CreateBasicGeoPosition(FbPicInfo pic) { BasicGeoposition location = new BasicGeoposition(); location.Latitude = pic.latitude; location.Longitude = pic.longitude; return(location); }
/*Method stores pics in the local database */ private void StorePicture(Datum pic, PicturePlaceDb db) { var picInfo = new FbPicInfo { city = pic.place.location.city, country = pic.place.location.country, latitude = pic.place.location.latitude, longitude = pic.place.location.longitude, id = pic.id, name = pic.place.name, source = pic.source }; db.Add(picInfo); db.SaveChanges(); }