Exemplo n.º 1
0
 /// <summary>
 /// Handler for the StatusChanged event. This invokes MyStatusChanged on the UI thread and
 /// passes the GeoPositionStatusChangedEventArgs
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => MyStatusChanged(e));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Custom method called from the StatusChanged event handler
        /// </summary>
        /// <param name="e"></param>
        void MyStatusChanged(GeoPositionStatusChangedEventArgs e)
        {
            switch (e.Status)
            {
                case GeoPositionStatus.Disabled:
                    // The location service is disabled or unsupported.
                    // Alert the user
                    StatusTextBlock.Text = "location is unsupported on this device";
                    break;
                case GeoPositionStatus.Initializing:
                    // The location service is initializing.
                    // Disable the Start Location button
                    StatusTextBlock.Text = "initializing location service," + accuracyText;
                    break;
                case GeoPositionStatus.NoData:
                    // The location service is working, but it cannot get location data
                    // Alert the user and enable the Stop Location button
                    StatusTextBlock.Text = "data unavailable," + accuracyText;
                    break;
                case GeoPositionStatus.Ready:
                    // The location service is working and is receiving location data
                    // Show the current position and enable the Stop Location button
                    StatusTextBlock.Text = "receiving data, " + accuracyText;
                    break;

            }
        }