// method overloaded to load the data from the categories table, and build an object to display inside the category carousel
 private void loadDataToDisplay(List <Category> tab)
 {
     dc           = new yummyDatabaseDataContext();
     myCategories = new List <MediaData>();
     foreach (var categoryObj in tab)
     {
         MediaData cnt = new MediaData();
         if (categoryObj.CategoryImage != null)
         {
             cnt.ImageData = cnt.ByteArrayToImage(categoryObj.CategoryImage.ToArray());
         }
         cnt.Id    = categoryObj.CategoryId;
         cnt.Title = categoryObj.CategoryName;
         myCategories.Add(cnt);
     }
     CategoriesCarousel.ItemsSource = myCategories; // setting the carousel data
 }
Beispiel #2
0
 // method overloaded to load the data from the categories table, and build an object to display inside the category carousel
 private void loadDataToDisplay(List <Recipe> tab)
 {
     dc        = new yummyDatabaseDataContext();
     myRecipes = new List <MediaData>();
     foreach (var recipeObj in tab)
     {
         MediaData cnt = new MediaData();
         if (recipeObj.Image != null)
         {
             cnt.ImageData = cnt.ByteArrayToImage(recipeObj.Image.ToArray());
         }
         cnt.Id          = recipeObj.RecipeId;
         cnt.Title       = recipeObj.Name;
         cnt.Description = recipeObj.Description;
         myRecipes.Add(cnt);
     }
     RecipesCarousel.ItemsSource = myRecipes;
 }
Beispiel #3
0
        // method overloaded to load the data from the categories table, and build an object to display inside the category carousel
        private void loadDataToDisplay(List <Category> tab)
        {
            dc           = new yummyDatabaseDataContext();
            myCategories = new List <MediaData>();

            // for each category inside the table build a Media data instance
            foreach (var categoryObj in tab)
            {
                MediaData cnt = new MediaData();
                if (categoryObj.CategoryImage != null)
                {
                    // getting the array of bytes and converting to a displayable image
                    cnt.ImageData = cnt.ByteArrayToImage(categoryObj.CategoryImage.ToArray());
                }
                cnt.Id    = categoryObj.CategoryId;
                cnt.Title = categoryObj.CategoryName;

                // add instance of MediaData to the list that will be used inside de carousel
                myCategories.Add(cnt);
            }
            CategoriesCarousel.ItemsSource = myCategories; // setting the carousel data
        }
Beispiel #4
0
        // method overloaded to load the data from the recipes table, and build an object to display inside the recipe carousel
        private void loadDataToDisplay(List <Recipe> tab)
        {
            dc        = new yummyDatabaseDataContext();
            myRecipes = new List <MediaData>();

            // for each recipe inside the table build a Media data instance
            foreach (var recipeObj in tab)
            {
                MediaData cnt = new MediaData();
                if (recipeObj.Image != null)
                {
                    // getting the array of bytes and converting to a displayable image
                    cnt.ImageData = cnt.ByteArrayToImage(recipeObj.Image.ToArray());
                }
                cnt.Id          = recipeObj.RecipeId;
                cnt.Title       = recipeObj.Name;
                cnt.Description = recipeObj.Description;

                // add instance of MediaData to the list that will be used inside de carousel
                myRecipes.Add(cnt);
            }

            RecipesCarousel.ItemsSource = myRecipes; // setting the carousel data
        }