Exemple #1
0
        private void HandleFavClickedStart(object sender, DialogClickEventArgs e)
        {
            List <FavoriteLocation> favorites = FavoritesRepository.GetFavoriteLocations() as List <FavoriteLocation>;

            if (FavClickedAction != null)
            {
                FavClickedAction(favorites [e.Which].Location);
            }
        }
Exemple #2
0
        public void OnSaveFavorite(String favoriteLocation)
        {
            FavoriteLocation favLoc = new FavoriteLocation();

            favLoc.Location = favoriteLocation;
            FavoritesRepository.SaveFavoriteLocation(favLoc);

            var builder = new AlertDialog.Builder(activity);

            builder.SetTitle("Favorites");
            builder.SetMessage("Saved to favorites");
            builder.SetNegativeButton("OK", (object sender, DialogClickEventArgs e) => {
                (sender as Dialog).Cancel();
            });
            builder.Create().Show();
        }
Exemple #3
0
        public void ShowFavoritesList(Action <String> stringAction)
        {
            FavClickedAction = stringAction;

            List <FavoriteLocation> favorites = FavoritesRepository.GetFavoriteLocations() as List <FavoriteLocation>;

            List <String> favStringArray = new List <string> ();

            foreach (FavoriteLocation fav in favorites)
            {
                favStringArray.Add(fav.Location);
            }

            var builder = new AlertDialog.Builder(activity);

            builder.SetTitle("Favorites");
            builder.SetItems(favStringArray.ToArray(), HandleFavClickedStart);
            builder.SetNegativeButton("Cancel", (object sender, DialogClickEventArgs e) => {
                (sender as Dialog).Cancel();
            });
            builder.Create().Show();
        }
Exemple #4
0
 static FavoritesRepository()
 {
     me = new FavoritesRepository();
 }