Beispiel #1
0
        private async void ImageList_Tapped(object sender, TappedRoutedEventArgs e)
        {
            this.SingleTap = true;
            await Task.Delay(200);

            if (this.SingleTap)
            {
                Image img = sender as Image;
                SelectedImage = img;

                var OriginalUrl = ((BitmapImage)img.Source).UriSource.OriginalString;
                SingleImage.Source = Uri.IsWellFormedUriString(GiphyImage.ConvertSourceType(OriginalUrl, SettingsItem.GifQuality), UriKind.Absolute) ?
                                     new BitmapImage(new Uri(GiphyImage.ConvertSourceType(OriginalUrl, SettingsItem.GifQuality))) :
                                     new BitmapImage(new Uri(GiphyImage.ConvertSourceType(OriginalUrl, "High")));
                SingleImageWrapper.Visibility = Visibility.Visible;
                ContentWrapper.Visibility     = Visibility.Collapsed;

                if (ShowSingleImageIcons != null)
                {
                    ShowSingleImageIcons();
                }

                SystemNavigationManager.GetForCurrentView().BackRequested += OnCloseRequest;
                Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            }
        }
Beispiel #2
0
        private void SaveCategoryButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (SelectedCategories.Count == 0)
                {
                    if (GifologyDatabase.GetFavorite(SelectedImage.Name) != null)
                    {
                        GifologyDatabase.DeleteFavoriteId(SelectedImage.Name);
                        Favorites data = new Favorites
                        {
                            Giphy_Id = SelectedImage.Name,
                            Url      = GiphyImage.ConvertSourceType(((BitmapImage)SelectedImage.Source).UriSource.OriginalString, "original"),
                            Category = 1
                        };

                        GifologyDatabase.InsertUpdateFavorite(data);
                    }
                }
                else
                {
                    GifologyDatabase.DeleteFavoriteId(SelectedImage.Name);
                    for (int i = 0; i < SelectedCategories.Count; i++)
                    {
                        Favorites data = new Favorites
                        {
                            Giphy_Id = SelectedImage.Name,
                            Url      = GiphyImage.ConvertSourceType(((BitmapImage)SelectedImage.Source).UriSource.OriginalString, "original"),
                            Category = SelectedCategories[i]
                        };
                        GifologyDatabase.InsertUpdateFavorite(data);
                    }
                }
            }
            catch (SQLite.SQLiteException ex)
            {
                SelectedCategories.Clear();
                Debug.WriteLine("DB EXCEPTION: " + ex.Message);
            }

            _this.Visibility = Visibility.Collapsed;
        }