Esempio n. 1
0
        private async void CategoryAppButton_Click(object sender, RoutedEventArgs e)
        {
            var img = GetSelectedImage();

            if (img != null)
            {
                CategoryList.Clear();
                var giphy_id = img.Name;

                var SelectedCategories = await GifologyDatabase.GetImageCategory(giphy_id);

                var AllCategories = await GifologyDatabase.GetCategoryList();

                for (int i = 0; i < AllCategories.Count; i++)
                {
                    CategoryList.Add(new CategoryListItem
                    {
                        Id        = (int)AllCategories[i].Id,
                        Name      = AllCategories[i].Name,
                        IsChecked = SelectedCategories.IndexOf((int)AllCategories[i].Id) != -1
                    });
                }

                CategoryListControl.SelectedCategories = SelectedCategories;
                CategoryListControl.SelectedImage      = img;
                CategoryListControl.CategoryList       = CategoryList;
                CategoryListControl.Visibility         = Visibility.Visible;
            }
        }
Esempio n. 2
0
        private async void ReloadCategories()
        {
            var List = await GifologyDatabase.GetCategoryList();

            var NewList = new ObservableCollection <CategoryListItem>();

            for (int i = 0; i < List.Count; i++)
            {
                NewList.Add(new CategoryListItem
                {
                    Id        = (int)List[i].Id,
                    Name      = List[i].Name,
                    IsChecked = SelectedCategories.IndexOf((int)List[i].Id) != -1
                });
            }

            CategoryList = NewList;
        }