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() { 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); } }
private void HandleFavoriteClick(object sender, EventArgs e) { var vm = (SessionDetailsViewModel)DataContext; if (FavoritesManager.IsFavorite(vm.Key)) { FavoritesManager.RemoveFavoriteSession(vm.Key); UpdateFavoriteButtonIcon(false); } else { FavoritesManager.AddFavoriteSession(new Favorite { SessionKey = vm.Key, }); UpdateFavoriteButtonIcon(true); } vm.UpdateIsFavorite(); }