Exemple #1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            AppSettings = new AppSettings();

            if (AppSettings.LocationConsent == false)
            {
                var result = MessageBox.Show("This app accesses your phone's location. Is that ok?", "Location", MessageBoxButton.OKCancel);
                AppSettings.LocationConsent = result == MessageBoxResult.OK;
            }

            Map = new Map(MainMap);

            ToggleMetric.IsChecked = AppSettings.ShowMetric;

            // Ensure our background agent is runnin'
            if (!_backgroundAgent.IsRunning())
            {
                _backgroundAgent.StartPeriodicAgent();
            }
            ToggleAgent.IsChecked = _backgroundAgent.IsRunning();

            // Center the map where the we last saw the user...
            MainMap.Center = new GeoCoordinate(AppSettings.LastKnownLatitude, AppSettings.LastKnownLongitude);

            // Check if we have a friend's pin to show too!
            string strItemIndex;

            if (NavigationContext.QueryString.TryGetValue("Location", out strItemIndex))
            {
                _friendLocation = new Location();
                _friendLocation = _friendLocation.DataStringToLocation(strItemIndex);
            }

            Geolocator = new Geolocator();

            Animation = new Animation(false, false);

            RefreshLocation();
        }
Exemple #2
0
        private void PinLiveTileClick(object sender, EventArgs e)
        {
            if (DigitalDash.Core.Classes.LiveTile.Exists())
            {
                DigitalDash.UI.Classes.LiveTile.Remove();
            }
            else
            {
                // You want the live tile, you need the agent!
                _scheduledBackgroundAgent.StartPeriodicAgent();

                DigitalDash.UI.Classes.LiveTile.Create();

                UpdateLiveTile();
            }

            SetPinIcon();
        }
Exemple #3
0
 private void BackgroundAgentToggleChecked(object sender, RoutedEventArgs e)
 {
     _backgroundAgent.StartPeriodicAgent();
 }