Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        /* ************************
         * 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;
                    }
                }
            }
        }