/* ************************ * VISUAL SWYPE (ITEM MOVE) * ************************ */ private async void ItemSwipeTriggerComplete(object sender, LLM.SwipeCompleteEventArgs args) { LLM.LLMListViewItem item = (LLM.LLMListViewItem)sender; Quote quote = (Quote)item.Content; if (args.SwipeDirection == LLM.SwipeDirection.Left) { quote.IsShared = false; Controller.share(quote); } else { // Favorite/Un-Favorite if (FavoritesController.IsFavorite(quote.Link)) { // Remove from favorites bool result = await FavoritesController.RemoveFavorite(quote); if (result) { quote.IsFavorite = false; } } else { // Add to favorites bool result = await FavoritesController.AddFavorite(quote); if (result) { quote.IsFavorite = true; } } } }
private async void Favorite_Tapped(object sender, TappedRoutedEventArgs e) { FontIcon icon = (FontIcon)sender; Quote quote = (Quote)icon.DataContext; if (FavoritesController.IsFavorite(quote.Link)) { // Remove from favorites bool result = await FavoritesController.RemoveFavorite(quote); if (result) { quote.IsFavorite = false; } } else { // Add to favorites bool result = await FavoritesController.AddFavorite(quote); if (result) { quote.IsFavorite = true; } } }
/* *************** * EVENTS HANDLERS * *************** */ private async void Favorite_Tapped(object sender, TappedRoutedEventArgs e) { FontIcon icon = (FontIcon)sender; Quote quote = (Quote)icon.DataContext; bool result = await FavoritesController.RemoveFavorite(quote, FavoritesController.CollectionType.favorites); }