Ejemplo n.º 1
0
        private async void ListenToNextPointOfInterest()
        {
            var point = GetNextPointOfInterest(true);

            if (point != null)
            {
                await BingMapsWrapper.PointOfInterestEntered(async interest =>
                {
                    await Dispatcher.TryRunAsync(CoreDispatcherPriority.Normal, async() =>
                    {
                        if (interest.IsVisited)
                        {
                            return;
                        }
                        if (interest.GetType() == typeof(PointOfInterest))
                        {
                            var poi = (PointOfInterest)interest;
                            NotificationSystem.NotificationSystem.SenToastificationAsync(poi.GetNotification());
                            NotificationSystem.NotificationSystem.SendVibrationNotificationAsync();
                            var g = new PointDataPage(poi);
                            await g.ShowAsync();
                        }
                        interest.IsVisited = true;
                        ListenToNextPointOfInterest();
                        ShowNewRoute(await BingMapsWrapper.GetCurrentPosition());
                        RouteProgressIO.SaveRouteProgressToFile(route);

                        //@TODO PLACE ON BETER LOCATION OR ON NEW TASK
                        if (point is PointOfInterest)
                        {
                            var icon = _routeIcons[(PointOfInterest)point];
                            if (icon == null)
                            {
                                return;
                            }
                            icon.Image =
                                RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Point visited.png"));
                        }
                    });
                }, point);
            }
            else
            {
                switch (Settings.Language)
                {
                case VVVOnTheWay.Language.ENGLISH:
                    NotificationSystem.NotificationSystem.SenToastificationAsync(
                        new Notification("End of the route.",
                                         "You have reached the end of the route. You can turn in your phone to the VVV employee."));
                    break;

                case VVVOnTheWay.Language.DUTCH:
                    NotificationSystem.NotificationSystem.SenToastificationAsync(
                        new Notification("Einde van de route.",
                                         "U heeft de route afgerond. U kan nu de telefoon inleveren bij de VVV medewerker."));
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            route = e.Parameter as Route.Route;
            RouteProgressIO.SaveRouteProgressToFile(route);

            BingMapsWrapper.ClearGeofences();
            await GetUserLocation();

            AddPointsOfInterest();
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     This method checks if there is an already existing saved route with progress from the user.
 /// </summary>
 /// <param name="rootFrame">The frame to be used to navigate to the next page</param>
 private async void ApplicationStartRouteCheck(Frame rootFrame)
 {
     Route.Route existing = null;
     if (await RouteProgressIO.CheckIfLastSavedRouteExists())
     {
         existing = await RouteProgressIO.LoadLastSavedRouteFromFile();
     }
     if (existing != null)
     {
         rootFrame.Navigate(typeof(MapPage), existing);
     }
     else
     {
         rootFrame.Navigate(typeof(RouteSelectionPage), null);
     }
 }