當前位置: 首頁>>代碼示例>>C#>>正文


C# Geolocation.PositionChangedEventArgs類代碼示例

本文整理匯總了C#中Windows.Devices.Geolocation.PositionChangedEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# PositionChangedEventArgs類的具體用法?C# PositionChangedEventArgs怎麽用?C# PositionChangedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PositionChangedEventArgs類屬於Windows.Devices.Geolocation命名空間,在下文中一共展示了PositionChangedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: myPosition_Changed

        private void myPosition_Changed(Geolocator sender, PositionChangedEventArgs args)
        {
            Dispatcher.BeginInvoke(()=>
            {
                try
                {
                    double CurrentSpeed = (double)args.Position.Coordinate.Speed;
                    double CurrentHeading = (double)args.Position.Coordinate.Heading;
                    string heading = CurrentHeading.ToString();
                    CurrentHeading = heading == "NaN" ? 0 : CurrentHeading;
                    mainMap.Heading = CurrentHeading;
                    mainMap.Center.Longitude = args.Position.Coordinate.Longitude;
                    mainMap.Center.Latitude = args.Position.Coordinate.Latitude;
                    mainMap.Center.Altitude = (double)args.Position.Coordinate.Altitude;
                    MyCoordinate.Longitude = mainMap.Center.Longitude;
                    MyCoordinate.Latitude = mainMap.Center.Latitude;
                    MyCoordinate.Altitude = mainMap.Center.Altitude;
                    mainMap.ZoomLevel = 13;
                    if (Car.Content == null)
                    {
                        Car.Content = CarPolygon;
                    }
                    Car.GeoCoordinate = new GeoCoordinate(args.Position.Coordinate.Latitude, args.Position.Coordinate.Longitude);

                    if (routepoints!= null && routepoints.Count > 0)
                    {
                        double distMeters = GeoMath.Distance(Car.GeoCoordinate.Longitude, Car.GeoCoordinate.Latitude, routepoints[0].Geo_Coordinate.Longitude, routepoints[0].Geo_Coordinate.Latitude, GeoMath.MeasureUnits.Kilometers);
                        distMeters = distMeters * 1000;
                    }
                }
                catch (Exception ex)
                {
                }
            });  
        }
開發者ID:kluesman,項目名稱:Freeway,代碼行數:35,代碼來源:MainPage.xaml.cs

示例2: Geolocator_PositionChanged

        async private void Geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args) {
            try {
                // Carry out the operation
                Geoposition pos = await sender.GetGeopositionAsync();

                latTB.Text = pos.Coordinate.Latitude.ToString();
                longTB.Text = pos.Coordinate.Longitude.ToString();

                coordinateLabel.Text = "Accuracy: " + pos.Coordinate.Accuracy.ToString();
                coordinateLabel.Text += " Time: " + pos.Coordinate.Timestamp.ToString("HH:mm:ss");
                if (pos.Coordinate.Altitude != null) {
                    coordinateLabel.Text += " Altitude: " + pos.Coordinate.Altitude.ToString();
                }
                if (pos.Coordinate.Heading != null) {
                    coordinateLabel.Text += " Heading: " + pos.Coordinate.Heading.ToString();
                }
                if (pos.Coordinate.Speed != null) {
                    coordinateLabel.Text += " Speed: " + pos.Coordinate.Speed.ToString();
                }

                addressLabel.Text = "Country: " + pos.CivicAddress.Country;
                if (!String.IsNullOrEmpty(pos.CivicAddress.City)) {
                    addressLabel.Text += " City: " + pos.CivicAddress.City;
                }
            } catch (System.UnauthorizedAccessException) {
                statusLabel.Text = "No data";
            } catch (TaskCanceledException) {
                statusLabel.Text = "Cancelled";
            }
        }
開發者ID:banec,項目名稱:GPS-Test,代碼行數:30,代碼來源:MainForm.cs

示例3: OnPositionChanged

 private void OnPositionChanged(Geolocator sender, PositionChangedEventArgs args)
 {
     if (PositionChanged != null)
     {
         PositionChanged(this, new CustomPositionChangedEventArgs(args.Position.Coordinate.Speed));
     }
 }
開發者ID:LimmaPaulus,項目名稱:Taksari,代碼行數:7,代碼來源:GPSTracker_WP.cs

示例4: geolocator_PositionChanged

 void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
 {
     if (!isTracking)
         return;
     else
         lastKnownPosition = args.Position;
 }
開發者ID:jleh,項目名稱:WP-RGTracker,代碼行數:7,代碼來源:MainPage.xaml.cs

示例5: geolocator_PositionChanged

        private async void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
        {
            var pos = await geolocator.GetGeopositionAsync();
            path.Update(
                pos.Coordinate.Latitude,
                pos.Coordinate.Longitude);
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
				if(UserState.UseOldUnits)
				{
					DistanceDisplay.Text = "Distance: " + path.Distance + " miles";
				}
				else
				{
					DistanceDisplay.Text = "Distance: " + (path.Distance/3.0) + " leagues";
				}

                Map.Visibility = Windows.UI.Xaml.Visibility.Visible;
                Map.Center = new Geopoint(path.Last());

                MapPolyline poly = new MapPolyline();
                poly.Path = new Geopath(path.Coordinates);
                poly.StrokeColor = Color.FromArgb(255, 120, 220, 140);
                poly.StrokeThickness = 5.0;
                poly.Visible = true;

                Map.MapElements.Clear();
                Map.MapElements.Add(poly);
            });
        }
開發者ID:tblue1994,項目名稱:SoftwareEngineeringProject2015,代碼行數:30,代碼來源:GatherActivityPage.xaml.cs

示例6: locator_PositionChanged

        void locator_PositionChanged(Geolocator sender, PositionChangedEventArgs args) {

            var position = args.Position;
            currentLocation = position.Coordinate.Point;
            string longiNew = position.Coordinate.Point.Position.Longitude.ToString();
            string latiNew = position.Coordinate.Point.Position.Latitude.ToString();
            
            //this.currentLocation = position.Coordinate.Point;
            //Zbog prčkanja po UI threadu 
            Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync
            (Windows.UI.Core.CoreDispatcherPriority.Normal, () => {



                if (longi != longiNew || lati != latiNew) {
                    UpdateMap(); //Ažuriraj poziciju na mapi
                    UpdateUICoords(); //ažuriraj prikaz na sučelju
                    UpdateFile(); //Ažuriraj poziciju u fajl    
                }
                
                if (longi != longiNew) longi = longiNew;
                if (lati != latiNew) lati = latiNew;     
                
            });
        }
開發者ID:zeljkom,項目名稱:nn,代碼行數:25,代碼來源:MainPage.xaml.cs

示例7: OnPositionChanged

    private void OnPositionChanged(Geolocator geolocator, PositionChangedEventArgs args)
    {
      if(App.RunningInBackground)
      {
        var toast = new Microsoft.Phone.Shell.ShellToast
        {
          Content = args.Position.Coordinate.Latitude.ToString("0.00"),
          Title = "Standort: ",
          NavigationUri = new Uri("/MainPage.xaml", UriKind.Relative)
        };

        toast.Show();
      }
      else
      {
        Dispatcher.BeginInvoke(() =>
        {
          Latitude.Text = args.Position.Coordinate.Latitude.ToString("F5");
          Longitude.Text = args.Position.Coordinate.Longitude.ToString("F5");

          _polyline.Path.Add(args.Position.ToGeoCoodinate());

          Map.SetView(args.Position.ToGeoCoodinate(), 16);
        });
      }
    }
開發者ID:GregOnNet,項目名稱:WP8BookSamples,代碼行數:26,代碼來源:MainPage.xaml.cs

示例8: Geolocator_PositionChanged

        void Geolocator_PositionChanged( Geolocator sender, PositionChangedEventArgs args )
        {
            RemainingDuration -= SamplingRate;

            if ( RemainingDuration <= 0 )
            {
                Geolocator.PositionChanged -= Geolocator_PositionChanged;
                Geolocator = null;

                RecordingButton.Content = "Start Recording";
            }

            UnsavedData.Add( new GpxCoordinate( args.Position.Coordinate, DateTime.Now ) );

            TimeSpan timeSinceLastSave = DateTime.Now - UnsavedData[0].Time;

            if ( timeSinceLastSave.Minutes >= 1 )
            {
                IList<IGpxSerializable> unsavedData = UnsavedData;
                UnsavedData = new List<IGpxSerializable>();

                if ( !Records.Contains( RecordName ) )
                {
                    Records.Add( RecordName );
                }

                GpxFiles.WriteToGpxFile( RecordName, unsavedData );
            }
        }
開發者ID:BradleyMarie,項目名稱:LocationRecorder,代碼行數:29,代碼來源:MainPage.xaml.cs

示例9: OnPositionChanged

 async private void OnPositionChanged(Geolocator sender, PositionChangedEventArgs e) 
 {
     await getDispatcher().RunAsync(CoreDispatcherPriority.Normal, () => 
     {
         setLocation(e.Position.Coordinate.Point);
     });
 }
開發者ID:JabX,項目名稱:velobster,代碼行數:7,代碼來源:LocationProvider.cs

示例10: sortArray

        public double[] sortArray(int order, Geolocator sender, PositionChangedEventArgs args)
        {
            double[][] inputArray;

            inputArray = new double[5][];
             output = new double[5][];
            finalArray = new double[5];

            inputArray = arrayOfDistances(sender, args);

            for (int counter = 0; counter < 5; counter++)
            {
                finalArray[counter] = inputArray[counter][1];
            }

            quickSort(finalArray, 0, finalArray.Length);

            for (int counter = 0; counter < 5; counter++)
            {
                for (int counter2 = 0; counter2 < 5; counter2++)
                {
                    if (finalArray[counter] == inputArray[counter2][1]) output[counter] = inputArray[counter2];

                }

            }

                //finalArray =
                return output[order];
        }
開發者ID:vladk1,項目名稱:Kaizen,代碼行數:30,代碼來源:SelectBuildings.cs

示例11: watcher_PositionChanged

 async void watcher_PositionChanged(Geolocator sender, PositionChangedEventArgs e)
 {
     lastPosition = await sender.GetGeopositionAsync();
     if (lastPosition != null && lastPosition.Coordinate.AltitudeAccuracy.HasValue)
     {
         getLocationListener().locationUpdated(convert(lastPosition));
     }
 }
開發者ID:sannysanoff,項目名稱:CodenameOne,代碼行數:8,代碼來源:LocationManager.cs

示例12: GPSPositionChanged

        // :GPS events
        void GPSPositionChanged(Geolocator sender, PositionChangedEventArgs args)
        {
            DateTime currentTime = DateTime.Now;

            // Extern
            if (GPSLocationChanged != null)
                GPSLocationChanged(args.Position.Coordinate.Latitude, args.Position.Coordinate.Longitude, currentTime);
        }
開發者ID:Zaixu,項目名稱:Runup,代碼行數:9,代碼來源:GPSService.cs

示例13: glocator_PositionChanged

 //Async Execution of the event
 async void glocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
 {
     await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, new DispatchedHandler(
       () =>
       {
           GetMyPosition(this, args);
       }));
 }
開發者ID:dotnetcurry,項目名稱:bingmaps-win8-store,代碼行數:9,代碼來源:MainPage.xaml.cs

示例14: Locator_PositionChanged

 private static async void Locator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
 {
     if (Dispatcher == null) return;
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
     {
         OnLocationChanged();
     });
 }
開發者ID:AlexKven,項目名稱:OneAppAway-RTM,代碼行數:8,代碼來源:LocationManager.cs

示例15: _geolocator_PositionChanged

 private async void _geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
 {
     await DispatcherHelper.RunAsync(() =>
     {
         Coordinates =
             $"{args.Position.Coordinate.Point.Position.Latitude}, {args.Position.Coordinate.Point.Position.Longitude}";
     });
 }
開發者ID:liqinghuang,項目名稱:UWP-MVVMSamples,代碼行數:8,代碼來源:MainViewModel.cs


注:本文中的Windows.Devices.Geolocation.PositionChangedEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。