Example #1
0
 private void SecondaryTileInvoked(SecondaryTilePayload secondaryTileArgs)
 {
     if (secondaryTileArgs.SecondaryTileType == TileType.FavoritePlace)
     {
         var firstPlace = secondaryTileArgs.SecondaryTilePlaces.First();
         ToPlace = new Place {
             Type = PlaceType.Address, Lat = (float)firstPlace.Lat, Lon = (float)firstPlace.Lon, Name = firstPlace.Name
         };
         if (PlanTripCommand.CanExecute(null))
         {
             PlanTripCommand.Execute(null);
         }
     }
     else if (secondaryTileArgs.SecondaryTileType == TileType.FavoriteRoute) //todo: allow more than just from & to here
     {
         var firstPlace = secondaryTileArgs.SecondaryTilePlaces.First();
         FromPlace = new Place {
             Type = PlaceType.Address, Lat = (float)firstPlace.Lat, Lon = (float)firstPlace.Lon, Name = firstPlace.Name
         };
         var lastPlace = secondaryTileArgs.SecondaryTilePlaces.Last();
         ToPlace = new Place {
             Type = PlaceType.Address, Lat = (float)lastPlace.Lat, Lon = (float)lastPlace.Lon, Name = lastPlace.Name
         };
         if (PlanTripCommand.CanExecute(null))
         {
             PlanTripCommand.Execute(null);
         }
     }
 }
Example #2
0
        private string GetTileArgs(IFavorite favorite)
        {
            var place = favorite as FavoritePlace;

            if (place != null)
            {
                var tilePayload = SecondaryTilePayload.Create(TileType.FavoritePlace, new SimpleFavoritePlace[]
                {
                    new SimpleFavoritePlace {
                        Lat = place.Lat, Lon = place.Lon, Name = place.UserChosenName
                    }
                });
                return(JsonConvert.SerializeObject(tilePayload, Formatting.None));
            }

            var route = favorite as FavoriteRoute;

            if (route != null)
            {
                var tilePayload = SecondaryTilePayload.Create(TileType.FavoriteRoute, route.RoutePlaces);
                return(JsonConvert.SerializeObject(tilePayload, Formatting.None));
            }
            return(null);
        }