void _favouriteButton_Click(object sender, EventArgs e) { isFavorite = !isFavorite; if (isFavorite) { favoriteButton.SetBackgroundResource(Resource.Drawable.star_gold_selector); var fav = new Favorite { SessionID = session.ID, SessionKey = session.Key }; BL.Managers.FavoritesManager.AddFavoriteSession(fav); } else { favoriteButton.SetBackgroundResource(Resource.Drawable.star_grey_selector); BL.Managers.FavoritesManager.RemoveFavoriteSession(session.Key); } }
bool ToggleFavorite () { if (FavoritesManager.IsFavorite (session.Key)) { FavoritesManager.RemoveFavoriteSession (session.Key); return false; } else { var fav = new Favorite {SessionID = session.ID, SessionKey = session.Key}; FavoritesManager.AddFavoriteSession (fav); return true; } }
bool ToggleFavorite () { #warning This should really be session.FavoriteSessionsCommand.Execute(); if (FavoritesManager.IsFavorite(session.SessionKey)) { FavoritesManager.RemoveFavoriteSession(session.SessionKey); return false; } else { var fav = new Favorite { SessionID = session.ID, SessionKey = session.SessionKey }; FavoritesManager.AddFavoriteSession (fav); return true; } }
// API for managing favorites is via SessionName // since Session.ID might not survive data updates // (to be confirmed, adapt if required) public static int SaveFavorite (Favorite favorite) { //var fav = new Favorite { SessionKey = sessionKey }; return DL.MwcDatabase.SaveItem<Favorite>(favorite); }
bool ToggleFavorite () { if (FavoritesManager.IsFavorite (session.Key)) { FavoriteButton.SetImage (new UIImage(AppDelegate.ImageNotFavorite), UIControlState.Normal); FavoritesManager.RemoveFavoriteSession (session.Key); return false; } else { FavoriteButton.SetImage (new UIImage(AppDelegate.ImageIsFavorite), UIControlState.Normal); var fav = new Favorite{SessionID = session.ID, SessionKey = session.Key}; FavoritesManager.AddFavoriteSession (fav); return true; } }