Esempio n. 1
0
        private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {

            selectedphoto = e.NavigationParameter as PrismDemo.Models.Location;

            var fence = new Ellipse()
            {

                Fill = new SolidColorBrush(Colors.Blue),
                Stroke = new SolidColorBrush(Colors.White),
                StrokeThickness = 3,
                Width = 25,
                Height = 25,
               
            };

            TextBlock text = new TextBlock();
            text.FontSize = 20;
            text.Width = 200;
            text.TextWrapping = TextWrapping.Wrap;
            text.Text = selectedphoto.title;
            text.Foreground = new SolidColorBrush( Colors.Black);
            text.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            text.TextAlignment = TextAlignment.Center;

            StackPanel stak = new StackPanel();
            stak.Children.Add(text);
            stak.Children.Add(fence);



            Bing.Maps.Location locationpos = new Bing.Maps.Location(selectedphoto.latitude, selectedphoto.longitude);
            map1.SetView(locationpos, 16);

            map1.Children.Add(stak);

            MapLayer.SetPosition(stak, locationpos);
                        
        }
Esempio n. 2
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            StatusBar statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
            await statusBar.HideAsync();

            selectedphoto = e.Parameter as Location;

            MapIcon mapIcon = new MapIcon();
            mapIcon.Title = selectedphoto.title;
            mapIcon.Location = new Geopoint(new BasicGeoposition()
            {
                Latitude = selectedphoto.latitude,
                Longitude = selectedphoto.longitude
            });

            map1.MapElements.Insert(0, mapIcon);
            BasicGeoposition basic = new BasicGeoposition() { Latitude = selectedphoto.latitude, Longitude = selectedphoto.longitude };
            MapControl.SetLocation(mapIcon, new Geopoint(basic));
            MapControl.SetNormalizedAnchorPoint(mapIcon, new Point(0.5, 0.5));
            await map1.TrySetViewAsync(mapIcon.Location, 18D, 0, 0, MapAnimationKind.Bow);  

        }
        public async override void OnNavigatedTo(object navigationParameter, NavigationMode navigationMode, Dictionary<string, object> viewModelState)
        {

            if (navigationMode == NavigationMode.Back)
            {
                Listphoto = Statique.listphotodesc;
                SelectedPos = Statique.selectedpos;
                VisibleMap = Visibility.Visible;
                return;
            }


            string id = navigationParameter as string;
            selectedlocation = new Location();
            selectedphoto = Statique.listphotodesc.Where(x => x.id == id).ToList().FirstOrDefault();

            if(Statique.issearch)
            Listphoto = Statique.listphotodesc.Where(x=> x.search == true).ToList();
            else
            Listphoto = Statique.listphotodesc.Where(x => x.search == false).ToList();


            Statique.selectedpos = Listphoto.IndexOf(selectedphoto);
            SelectedPos = Statique.selectedpos;
            if ((selectedlocation = await _servicesPhoto.CheckforGeolocation(selectedphoto.id)) != null)
            {
                VisibleMap = Visibility.Visible;
            }
            else
            {
                VisibleMap = Visibility.Collapsed;

            }


        }
       // on swipping photo
        private async void OnPhotoChanged(SelectionChangedEventArgs obj)
         {
             if (obj.AddedItems.Count > 0)
             {
                  selectedphoto = obj.AddedItems[0] as Photo;
                  Statique.selectedpos = Statique.listphotodesc.IndexOf(selectedphoto);
                
                  if ((selectedlocation = await _servicesPhoto.CheckforGeolocation(selectedphoto.id)) != null)
                 {
                     VisibleMap = Visibility.Visible;

                 }
                 else
                 {
                     VisibleMap = Visibility.Collapsed;

                 }
                  
             }
         }