当前位置: 首页>>代码示例>>C#>>正文


C# Maps.Pushpin类代码示例

本文整理汇总了C#中Microsoft.Phone.Controls.Maps.Pushpin的典型用法代码示例。如果您正苦于以下问题:C# Pushpin类的具体用法?C# Pushpin怎么用?C# Pushpin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Pushpin类属于Microsoft.Phone.Controls.Maps命名空间,在下文中一共展示了Pushpin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ViewMap

        public ViewMap()
        {
            InitializeComponent();
            GeoCoordinateWatcher gcw;
            gcw = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
            // gcw.PositionChanged += new EventHandler( "");
            gcw.Start();
            GeoCoordinate co;
            co = gcw.Position.Location;
            if (thisApp.Long == -1000 && thisApp.Lat == -1000) { MessageBox.Show("Geographical coordinates have not been set yet."); }
            else { co = new GeoCoordinate((double)thisApp.Lat, (double)thisApp.Long);

            var pushPin = new Pushpin();

            var location = co;
            PushpinLayer.AddChild(pushPin, location);
            
            
            }
            // co.Latitude = 45;
            // co.Longitude = 25;

            map1.SetView(co, 10);


        }
开发者ID:evelinad,项目名称:TaskNotifier,代码行数:26,代码来源:ViewMap.xaml.cs

示例2: WorkoutMapStatisticsPage

        public WorkoutMapStatisticsPage()
        {
            InitializeComponent();
            routeLine = new MapPolyline();
            routeLine.Locations = selectedWorkout.routeLine.Locations; // Where the magic happens: Note: ALL routes MUST have a polyline, otherwise the application WILL ofcourse, CRASH!
            routeLine.Stroke = new SolidColorBrush(Colors.Blue);
            routeLine.StrokeThickness = 5;
            Pushpin pStart = new Pushpin();
            pStart.Content = "Start";
            pStart.Background = new SolidColorBrush(Colors.Green);
            Pushpin pFinish = new Pushpin();
            pFinish.Content = "Finish";
            pFinish.Background = new SolidColorBrush(Colors.Red);
            layer.AddChild(pStart, new GeoCoordinate(routeLine.Locations.First().Latitude, routeLine.Locations.First().Longitude));
            layer.AddChild(pFinish, new GeoCoordinate(routeLine.Locations.Last().Latitude, routeLine.Locations.Last().Longitude));
            map2.Children.Add(routeLine);
            map2.Children.Add(layer);
            textBlock5.Text = selectedWorkout.workoutName;
            textBlock6.Text = selectedWorkout.startTime;
            textBlock7.Text = String.Format("{0:F2}", selectedWorkout.distanceRan);
            textBlock8.Text = string.Format("{0:00}:{1:00}:{2:00}",
               selectedWorkout.elapsedTimeTS.Hours,
                selectedWorkout.elapsedTimeTS.Minutes,
                selectedWorkout.elapsedTimeTS.Seconds); ;

            double latitude;
            double longitude;
            getWorkoutRouteLocation(out latitude, out longitude);

            map2.Center = new GeoCoordinate(latitude, longitude);
            map2.ZoomLevel = 16;
        }
开发者ID:bemk,项目名称:wp7app,代码行数:32,代码来源:WorkoutMapStatisticsPage.xaml.cs

示例3: drawConcertToMap

        void drawConcertToMap()
        {
            map1.Children.Clear();

            //map1.Mode = new AerialMode();

            Pushpin pin = new Pushpin();
            pin.Location = new GeoCoordinate(Double.Parse(concert.Latitude, CultureInfo.InvariantCulture), Double.Parse(concert.Longitude, CultureInfo.InvariantCulture));
            pin.MouseLeftButtonUp += new MouseButtonEventHandler(pinMouseLeftButtonUp);
            pin.Template = (ControlTemplate)this.Resources["PinTemplate"];
            pin.Name = concert.Title;
            map1.Children.Add(pin);

            //Se hace un setView para encuadrar el Mapa. Para esto, se ponen todos los puntos en un IEnumerable y el sistema hace el encuadre solo
            List<GeoCoordinate> l = new List<GeoCoordinate>();
            foreach (Pushpin p in map1.Children)
            {
                l.Add(p.Location);
            }

            loc = l;
            map1.SetView(LocationRect.CreateLocationRect(loc));

            map1.ZoomLevel = 15;
        }
开发者ID:joanromano,项目名称:O-Valiant-Hearts,代码行数:25,代码来源:Map.xaml.cs

示例4: MainPage

        // Constructor
        public MainPage()
        {
            InitializeComponent();

            bikePaths = new BikePaths();
            trees = Tree.ParseCsv();

            map = new Map();
            map.CredentialsProvider = new ApplicationIdCredentialsProvider("Atvj6eBBbDS6-dL7shp9KmzY-0v0NL2ETYCFoHIDzQwK8_9bJ2ZdRgeMAj0sDs_F");

            // Set the center coordinate and zoom level
            GeoCoordinate mapCenter = new GeoCoordinate(45.504693, -73.576494);
            int zoom = 14;

            // Create a pushpin to put at the center of the view
            Pushpin pin1 = new Pushpin();
            pin1.Location = mapCenter;
            pin1.Content = "McGill University";
            map.Children.Add(pin1);

            bikePaths.AddPathsToMap(map);

            // Set the map style to Aerial
            map.Mode = new Microsoft.Phone.Controls.Maps.AerialMode();

            // Set the view and put the map on the page
            map.SetView(mapCenter, zoom);
            ContentPanel.Children.Add(map);
        }
开发者ID:TryCatch22,项目名称:Project-Beaver,代码行数:30,代码来源:MainPage.xaml.cs

示例5: Pushpins

        public void Pushpins(Collection<Marker> markers)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                //this.pushpinCollection.Clear();
                Style style = this.Resources["PushpinMarkerStyle"] as Style;
                //foreach (var item in this.googlemap.Children)
                //{
                //    if (item is Pushpin)
                //    {
                //        this.googlemap.Children.Remove(item);
                //    }
                //}
                foreach (Marker item in markers)
                {
                    Pushpin locationPushpin = new Pushpin();
                    locationPushpin.Background = new SolidColorBrush(Colors.Gray);
                    locationPushpin.Content = Math.Round(item.db);
                    locationPushpin.Location = new GeoCoordinate(item.lat, item.lng);

                    this.googlemap.Children.Add(locationPushpin);
                    //locationPushpin.Style = style;

                    //PushpinModel model = new PushpinModel();
                    //model.Content = Math.Round(item.db).ToString();
                    //model.Location = new GeoCoordinate(item.lat, item.lng);

                    //this.pushpinCollection.Add(model);

                }

                //this.pushpins.DataContext = this.pushpinCollection;
            });
        }
开发者ID:airbai,项目名称:NoiseMap,代码行数:34,代码来源:GoogleMap.xaml.cs

示例6: Tick

        void Tick(object sender, EventArgs e)
        {
            try
            {
                var response = new WebClient();

                response.DownloadStringCompleted += (s, ea) =>
                {
                    JObject parsejson = JObject.Parse(ea.Result);
                    double lat = double.Parse( parsejson["latitude"]["DMS"]["value"].ToString());
                    double lon = double.Parse( parsejson["longitude"]["DMS"]["value"].ToString());

                   // double lat = 35.88923;
                   // double lon = 14.51721;

                    map.Center.Latitude = lat;
                    map.Center.Longitude = lon;

                    Pushpin mypin = new Pushpin();
                    mypin.Location = new GeoCoordinate(lat,lon);
                    map.Children.Add(mypin);

                };

                response.DownloadStringAsync(new Uri(ip + "gps/coordinates"));
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Connection error. Please try again. " + ex.Message);
            }
        }
开发者ID:marssa,项目名称:demonstrator-windowsphone7,代码行数:31,代码来源:NavDisplay.xaml.cs

示例7: GetElement

        /// <summary>
        /// Gets the visual representation of the contents of this container. If it is 
        /// a single pushpin, the pushpin itself is returned. If multiple pushpins are present
        /// a pushpin with the given clusterTemplate is returned.
        /// </summary>
        public FrameworkElement GetElement(DataTemplate clusterTemplate)
        {
            if (_pushpins.Count == 1)
            {
                return _pushpins[0];
            }
            else
            {
                Pushpin retPin = new Pushpin()
                {
                    Location = _pushpins.First().Location,
                    Content = _pushpins.Select(pin => pin.DataContext).ToList(),
                    ContentTemplate = clusterTemplate,
                    Background = new SolidColorBrush((Color)Application.Current.Resources["PhoneAccentColor"])

                };

                retPin.MouseLeftButtonUp += new MouseButtonEventHandler(
                        (object sender, MouseButtonEventArgs e) =>
                        {
                            _map.Center = retPin.Location;
                            _map.ZoomLevel = _map.ZoomLevel + 3;
                        });
                return retPin;
            }
        }
开发者ID:madisp,项目名称:Omnibuss,代码行数:31,代码来源:PushpinContainer.cs

示例8: MapCalls

                public MapCalls()
                {
                        this.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentUICulture.Name);
                        InitializeComponent();
                    ((MapCallsViewModel)DataContext).StartLocationService();

                        var bw = new BackgroundWorker();

                        bw.RunWorkerCompleted += (o, e) => {
                                _rvList = ReturnVisitsInterface.GetReturnVisits(SortOrder.DateNewestToOldest, -1);
                                for (_index = 0; _index < _rvList.Length; _index++) {
                                        if (_rvList[_index].Latitude == 0 || _rvList[_index].Longitude == 0){
                                                MakeGeocodeRequest(GetGeocodeAddress(_rvList[_index]));
                                                break;
                                        }
                                    var p = new Pushpin
                                    {
                                        Location = new Location
                                        {
                                            Longitude = _rvList[_index].Longitude,
                                            Latitude = _rvList[_index].Latitude
                                        },
                                        Content = _rvList[_index]
                                    };
                                    p.DoubleTap += POnDoubleTap;
                                        mRvMaps.Children.Add(p);
                                }
                        };
                        bw.RunWorkerAsync();
                }
开发者ID:darthcaedus58,项目名称:my-time-wp7,代码行数:30,代码来源:MapCalls.xaml.cs

示例9: draw_ClockToMap

        //Función para abrir el detalle de una oficina
        //void showOfficeInfo(office o)
        //{
        //    (App.Current as App).selectedOffice = o;
        //    NavigationService.Navigate(new Uri("/officeDetails.xaml", UriKind.Relative));
        /*officeDetails root = Application.Current.RootVisual as officeDetails;
            root.o = o;*/
        //MessageBox.Show(o.nombre);
        //}
        //Dibujamos las oficinas descargadas en el Mapa (y el punto donde nos encontramos
        void draw_ClockToMap()
        {
            map1.Children.Clear();

            //map1.Mode = new AerialMode();

            Pushpin pin = new Pushpin();
            pin.Location = new GeoCoordinate(clock.Lat,  clock.Lng);
            pin.MouseLeftButtonUp += new MouseButtonEventHandler(pin1_MouseLeftButtonUp);
            pin.Template = (ControlTemplate)this.Resources["PushpinClock"];
            pin.Name = clock.City;
            map1.Children.Add(pin);

            //Se hace un setView para encuadrar el Mapa. Para esto, se ponen todos los puntos en un IEnumerable y el sistema hace el encuadre solo
            List<GeoCoordinate> l = new List<GeoCoordinate>();
            foreach (Pushpin p in map1.Children)
            {
                l.Add(p.Location);
            }

            loc = l;
            map1.SetView(LocationRect.CreateLocationRect(loc));

            map1.ZoomLevel = 8;
        }
开发者ID:jordigaset,项目名称:GeoWorld-Clock,代码行数:35,代码来源:map.xaml.cs

示例10: OnNavigatedTo

        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            SystemTray.IsVisible = true;
            _centerId = NavigationContext.QueryString["CenterId"];
            _centerName = NavigationContext.QueryString["CenterName"];

            pivot.Title = _centerName;

            try
            {
                txtNoPacients.Visibility = Visibility.Collapsed;
                txtNoNeeds.Visibility = Visibility.Collapsed;

                _center = (await Service.GetTable<Center>()
                    .Where(t => t.Id == _centerId).ToListAsync()).FirstOrDefault();

                if (e.NavigationMode == NavigationMode.New)
                {
                    var isAttending = (await Service.GetTable<DisasterAttend>()
                    .Where(t => t.DisasterId == _center.DisasterId && t.ParticipantId == App.User.Id)
                    .ToListAsync()).FirstOrDefault();

                    if (App.User.Type == UserType.Medic && isAttending != null)
                    {
                        var button = new ApplicationBarIconButton
                        {
                            IconUri = new Uri("/Assets/AppBar/add.png", UriKind.RelativeOrAbsolute),
                            IsEnabled = true,
                            Text = "add patient"
                        };
                        button.Click += AddPatient_Click;
                        ApplicationBar.Buttons.Add(button);
                    }
                }

                var pin = new Pushpin()
                {
                    Location = new GeoCoordinate(_center.Latitude, _center.Longitude),
                    Content = _centerName,
                };
                map.Children.Add(pin);
                map.Center = new GeoCoordinate(_center.Latitude, _center.Longitude);

                var patients = await Service.GetTable<Pacient>().Where(t => t.CenterId == _centerId).ToListAsync();
                if (patients.Count == 0)
                    txtNoPacients.Visibility = Visibility.Visible;
                else lstPacients.ItemsSource = patients;

                var needs = await Service.GetTable<Needs>().Where(t => t.CenterId == _centerId).ToListAsync();
                if (needs.Count == 0)
                    txtNoNeeds.Visibility = Visibility.Visible;
                else 
                    lstNeeds.ItemsSource = needs;

            }
            catch (Exception ex)
            {
                MessageBox.Show("Something went wrong!");
            }
        }
开发者ID:radu-ungureanu,项目名称:DisasterHelp,代码行数:60,代码来源:ViewCenterDetailsPage.xaml.cs

示例11: watcher_PositionChanged

        void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
        {
            if (e.Position.Location.IsUnknown)
            {
                MessageBox.Show("Please wait while your prosition is determined....");
                return;
            }

            this.map.Center = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);

            if (this.map.Children.Count != 0)
            {
                var pushpin = map.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));

                if (pushpin != null)
                {
                    this.map.Children.Remove(pushpin);
                    
                }
            }

            Pushpin locationPushpin = new Pushpin();
            locationPushpin.Background = new SolidColorBrush(Colors.Purple);
            locationPushpin.Content = "You are here";
            locationPushpin.Tag = "locationPushpin";
            locationPushpin.Location = watcher.Position.Location;
            this.map.Children.Add(locationPushpin);
            this.map.SetView(watcher.Position.Location, 10.0);
            locationPushpin.Location = new GeoCoordinate(8.570515, 8.308844);
        }
开发者ID:BarkaBoss,项目名称:MedicNaijaWP7,代码行数:30,代码来源:Map.xaml.cs

示例12: JobMapView_Loaded

        void JobMapView_Loaded(object sender, RoutedEventArgs e)
        {
            mapJobLocation.CredentialsProvider = new ApplicationIdCredentialsProvider(AppResources.BingMapsApiKey);

            // Set the center coordinate and zoom level
            GeoCoordinate mapCenter = new GeoCoordinate(App.JobVM.JobInfo.LocationLatitude, App.JobVM.JobInfo.LocationLongitude);
            int zoom = 15;

            // Create a pushpin to put at the center of the view
            Pushpin pin1 = new Pushpin();
            pin1.Location = mapCenter;
            pin1.Style = (Style)App.Current.Resources["PushpinStyle"];
            TextBlock pinContent = new TextBlock
            {
                Text = App.JobVM.JobInfo.Ranking.ToString(),
                FontSize = 18.667,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center,
				Style = (Style)App.Current.Resources["PhoneTextYellowStyle"]
            };
            pin1.Content = pinContent;
            mapJobLocation.Children.Add(pin1);

            // Set the map style to Aerial
            mapJobLocation.Mode = new RoadMode();
            isRoadMode = true;

            // Set the view and put the map on the page
            mapJobLocation.SetView(mapCenter, zoom);
        }
开发者ID:deleolowoyo,项目名称:Job-Compass,代码行数:30,代码来源:JobMapView.xaml.cs

示例13: GetElement

        /// <summary>
        /// Gets the visual representation of the contents of this container. If it is 
        /// a single pushpin, the pushpin itself is returned. If multiple pushpins are present
        /// a pushpin with the given clusterTemplate is returned.
        /// </summary>
        public FrameworkElement GetElement(DataTemplate clusterTemplate)
        {
            if (_pushpins.Count == 1)
              {
            return _pushpins[0];

              }
              else
              {
              Pushpin pp = new Pushpin()
            {
              Location = _pushpins.First().Location,
              Content = /*_pushpins.Select(pin => pin.DataContext).Count().ToString()*/_pushpins.Count.ToString(),
              ContentTemplate = clusterTemplate,
              Tag =  _pushpins,
              Background = new SolidColorBrush(Colors.Red)

            };

              pp.MouseLeftButtonUp += (s, e) => {
                                              Pushpin p  = (Pushpin)s;
                                                List<Pushpin> lp = (List<Pushpin>)p.Tag;
                                              MessageBox.Show(lp.Count().ToString());
              };
              return pp;
              }
        }
开发者ID:doddoindan,项目名称:GeoGallery,代码行数:32,代码来源:PushpinContainer.cs

示例14: setupMap

        private void setupMap()
        {
            if (App.ViewModel.Settings.Locations.Count > 0)
            {
                //set the Bing maps key
                map.CredentialsProvider = new ApplicationIdCredentialsProvider(App.ViewModel.Settings.BingMapsKey);

                // Set the center coordinate and zoom level
                GeoCoordinate mapCenter = new GeoCoordinate(App.ViewModel.Settings.Locations[0].Latitude, App.ViewModel.Settings.Locations[0].Longitude);
                int zoom = 15;

                // create a pushpins for each location
                Pushpin pin = null;
                for (int i = 0; i < App.ViewModel.Settings.Locations.Count; i++)
                {
                    pin = new Pushpin();
                    pin.Location = new GeoCoordinate(App.ViewModel.Settings.Locations[i].Latitude, App.ViewModel.Settings.Locations[i].Longitude);
                    pin.Content = App.ViewModel.Settings.Locations[i].Title;
                    map.Children.Add(pin);
                }

                // Set the map style to Aerial
                map.Mode = new RoadMode();

                // Set the view and put the map on the page
                map.SetView(mapCenter, zoom);
            }
            else
            {
                //notify user
            }
        }
开发者ID:ChrisKoenig,项目名称:UTAustin,代码行数:32,代码来源:MapPage.xaml.cs

示例15: OnNavigatedTo

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string stopCoords = "";
            if (NavigationContext.QueryString.TryGetValue("stopCoords", out stopCoords))
            {

                coordsArray = stopCoords.Split(new Char[] { '|' });

                System.Diagnostics.Debug.WriteLine("stopCoords:" + stopCoords);
            }

            for (int i = 0; i < coordsArray.Length; i++)
            {
                String coordStr = coordsArray[i];
                String[] coordTempArray = coordStr.Split(',');

                System.Diagnostics.Debug.WriteLine("coordStr:" + coordStr + "," + coordTempArray[0] + "," + coordTempArray[1]);


                Pushpin p = new Pushpin();
                p.Template = this.Resources["pinStop"] as ControlTemplate;
                p.Location = new GeoCoordinate(Convert.ToDouble(coordTempArray[1]), Convert.ToDouble(coordTempArray[0]));
                mapControl.Items.Add(p);

                //set the first one as the center
                if (i == coordsArray.Length/2)
                {
                    map1.SetView(p.Location, 13.0);
                }
            }

        }
开发者ID:dajaywang,项目名称:hsl-windowsphone,代码行数:34,代码来源:MapDetailPage.xaml.cs


注:本文中的Microsoft.Phone.Controls.Maps.Pushpin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。