Beispiel #1
0
        /// <summary>
        /// Gets asynchroniously collection of recipeCovers
        /// </summary>
        /// <returns>OservableCollection of RecipeCover</returns>
        public async Task <ObservableCollection <RecipeCover> > GetRecipeCoversCollectionAsync()
        {
            var document = await GetDocumentAsync("https://www.atbmarket.com/trademark/advices");

            var ul    = document.QuerySelector("ul.brand_list");
            var liCol = ul.QuerySelectorAll("li");

            foreach (var item in liCol)
            {
                RecipeCover reC = new RecipeCover();
                reC.RecipeName = item.QuerySelector("h2.title").QuerySelector("a").TextContent;
                reC.RecipeLink = "https://www.atbmarket.com" + item.QuerySelector("a").GetAttribute("href");
                //string imgSRC = "https://www.atbmarket.com/" + item.QuerySelector("a").QuerySelector("img").GetAttribute("src");
                //reC.ImageCover = new BitmapImage(new Uri(imgSRC,UriKind.Absolute));

                reC = GetImage(reC);
                _recipesCoverCollection.Add(reC);
            }
            return(_recipesCoverCollection);
        }
Beispiel #2
0
        private RecipeCover GetImage(RecipeCover recipe)
        {
            switch (recipe.RecipeName)
            {
            case "Соус Італійський":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/ItalianSouce.jpg", UriKind.Absolute));
                break;

            case "Сирна паска з білим шоколадом":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/CheesePaskaWithWhiteChocolate.jpg", UriKind.Absolute));
                break;

            case "Торт \"Наполеон\"":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Napoleon.jpg", UriKind.Absolute));
                break;

            case "Солодкий пиріг з гарбуза":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/SweetPie.jpg", UriKind.Absolute));
                break;

            case "Суп Езо Гелин чорбаси":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/EzoSoup.jpg", UriKind.Absolute));
                break;

            case "Салат «Нісуаз» з тунцем ТМ «De Luxe Foods & Goods Selected»":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/NisuazSalat.jpg", UriKind.Absolute));
                break;

            case "Кальцоне з лососевим фаршем і шпинатом":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Calcone.jpg", UriKind.Absolute));
                break;

            case " Паелья з морепродуктами ":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Paelya.jpg", UriKind.Absolute));
                break;

            case "Польова каша":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Porridge.jpg", UriKind.Absolute));
                break;

            case "Куліч Пасхальний":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Paska.jpg", UriKind.Absolute));
                break;

            case "Кава з пінкою маршмеллоу":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Coffee.jpg", UriKind.Absolute));
                break;

            case "Бланманже сирне":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/BlanMange.jpg", UriKind.Absolute));
                break;

            case "Паста з сьомгою і креветками у вершковому соусі":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Pasta.jpg", UriKind.Absolute));
                break;

            case "Ватрушки з сиром":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Vatrushka.jpg", UriKind.Absolute));
                break;

            case "Окрошка з гірчицею":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Okroshka.jpg", UriKind.Absolute));
                break;

            case "Піца Пепероні":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Pizza.jpg", UriKind.Absolute));
                break;

            case "Різдвяна полента":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/polenta.jpg", UriKind.Absolute));
                break;

            case "Желейний торт «Мозаїка»":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Mozaika.jpg", UriKind.Absolute));
                break;

            case "Салат з креветками і помідорами чері":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/SalatWithCheri.jpg", UriKind.Absolute));
                break;

            case "Роли Філадельфія":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Rolly.jpg", UriKind.Absolute));
                break;

            case "Сирна закуска на чіпсах":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/CheeseWithChips.jpg", UriKind.Absolute));
                break;

            case "Вівсяно-арахісова гранола":
                recipe.ImageCover = new BitmapImage(new Uri("ms-appx:///Assets/Images/Granola.jpg", UriKind.Absolute));
                break;

            default:
                break;
            }

            return(recipe);
        }