コード例 #1
0
ファイル: MapPage.xaml.cs プロジェクト: KjaJong/VVVOnTheWay
 private async void Map_MapElementClick(MapControl sender, MapElementClickEventArgs args)
 {
     var clickedIcon = args.MapElements.FirstOrDefault(x => x is MapIcon) as MapIcon;
     var poi         = _routeIcons.FirstOrDefault(x => x.Value == clickedIcon).Key;
     var g           = new PointDataPage(poi);
     await g.ShowAsync();
 }
コード例 #2
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;
                }
            }
        }
コード例 #3
0
 private async void POIList_Click(object sender, RoutedEventArgs e)
 {
     foreach (var pair in _routeIcons)
     {
         var b = sender as Button;
         if (b == null)
         {
             continue;
         }
         if (b.Content.ToString() != pair.Key.Title[(int)Settings.Language])
         {
             continue;
         }
         var data = new PointDataPage(pair.Key);
         await data.ShowAsync();
     }
 }