static Recipe[] CreateDemoData ()
		{
			Assembly assembly = typeof (Recipe).Assembly;
			Recipe[] recipes = new Recipe [2];

			recipes[0] = new Recipe () {
				Name = "Cherry Cobbler",
				Description = "Cherry cobbler with homemade whipped cream",
				PrepTime = "1.5 hours",
				Image = UIImage.FromResource (assembly, "RecipesAndPrinting.Images.CherryCobbler.png"),
				ThumbnailImage = UIImage.FromResource (assembly, "RecipesAndPrinting.Images.CherryCobblerThumbnail.png"),
				Instructions = "Mix the ingredients, bake and voilà!",
				Ingredients = new Ingredient [10] {
					new Ingredient () { Name = "Cherries (fresh)", Amount = "3 cups" },
					new Ingredient () { Name = "White Sugar", Amount = "1/2 cup" },
					new Ingredient () { Name = "Brown Sugar", Amount = "1/2 cup" },
					new Ingredient () { Name = "Cinnamon", Amount = "1/8 tsp" },
					new Ingredient () { Name = "Nutmeg", Amount = "1/8 tsp" },
					new Ingredient () { Name = "Lemon Juice", Amount = "1 tsp" },
					new Ingredient () { Name = "Flour", Amount = "1 cup" },
					new Ingredient () { Name = "Baking Powder", Amount = "1 tsp" },
					new Ingredient () { Name = "Salt", Amount = "1/8 tsp" },
					new Ingredient () { Name = "Butter", Amount = "6 tbsp" },
				},
			};

			recipes[1] = new Recipe () {
				Name = "Chocolate Cake",
				Description = "Chocolate cake with chocolate frosting",
				PrepTime = "1 hour",
				Image = UIImage.FromResource (assembly, "RecipesAndPrinting.Images.ChocolateCake.png"),
				ThumbnailImage = UIImage.FromResource (assembly, "RecipesAndPrinting.Images.ChocolateCakeThumbnail.png"),
				Instructions = "Mix the ingredients, bake and voilà!",
				Ingredients = new Ingredient [5] {
					new Ingredient () { Name = "Chocolate", Amount = "1 cup" },
					new Ingredient () { Name = "Flour", Amount = "1 cup" },
					new Ingredient () { Name = "Eggs", Amount = "2" },
					new Ingredient () { Name = "Sugar", Amount = "1 cup" },
					new Ingredient () { Name = "Salt", Amount = "pinch" }
				},
			};

			return recipes;
		}
		void ShowRecipe (Recipe recipe, bool animated)
		{
			details = new RecipeDetailViewController (recipe);

			NavigationController.PushViewController (details, animated);
		}
		public RecipePrintPageRenderer (Recipe[] recipes)
		{
			this.HeaderHeight = 20.0f;
			this.FooterHeight = 20.0f;
			this.recipes = recipes;
		}
		// Custom code to draw upper portion of the recipe presentation (image, title, desc).
		// The argument rect is the full size of the recipe presentation.
		void DrawRecipe (Recipe recipe, RectangleF rect)
		{
			DrawRecipeImage (recipe.Image, rect);
			DrawRecipeName (recipe.Name, rect);
			DrawRecipeInfo (recipe.AggregatedInfo, rect);
		}
		public RecipeDetailViewController (Recipe recipe) : base (UITableViewStyle.Grouped)
		{
			tableSource = new RecipeDetailSource (this);
			NavigationItem.Title = "Recipe";
			Recipe = recipe;
		}
Пример #6
0
 // Custom code to draw upper portion of the recipe presentation (image, title, desc).
 // The argument rect is the full size of the recipe presentation.
 void DrawRecipe(Recipe recipe, RectangleF rect)
 {
     DrawRecipeImage(recipe.Image, rect);
     DrawRecipeName(recipe.Name, rect);
     DrawRecipeInfo(recipe.AggregatedInfo, rect);
 }
        void ShowRecipe(Recipe recipe, bool animated)
        {
            details = new RecipeDetailViewController(recipe);

            NavigationController.PushViewController(details, animated);
        }
            public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
            {
                Recipe recipe = Recipes[indexPath.Row];

                controller.ShowRecipe(recipe, true);
            }