public RecipeViewerViewModel() { Debug.WriteLine("Setting up ViewModel"); manager = RecipeManager.DefaultManager; Debug.WriteLine("fetching list"); //Recipe.RecipeName = "Scrambled Eggs"; //Recipe.Ingredients = "Eggs"; //Recipe.Instructions = "Whip eggs briskly"; //Recipe.Description = "A nice simple recipe for making scrambled eggs"; RecipeContent = String.Concat("\u2022", Recipe.Description); //var RecipeList = manager.GetRecipe("eggs"); //Recipe = manager.GetRecipe("eggs").Result; //var RL = manager.GetRecipesAsync(); var ye = GetRecipe("eggs"); Debug.WriteLine(ye); //Recipe = RL; //Debug.WriteLine(RL); //if (/*RecipeList*/ RL == null){ // Recipe.RecipeName = "Scrambled Eggs"; // Recipe.Ingredients = "Eggs"; // Recipe.Instructions = "Whip eggs briskly"; // Recipe.Description = "A nice simple recipe for making scrambled eggs"; //} else { // Debug.WriteLine("Found something??"); // Debug.WriteLine(RL.Status); //} DescriptionClicked = new Command(() => { RecipeContent = String.Concat("\u2022", Recipe.Description); }); InstructionClicked = new Command(() => { RecipeContent = String.Concat("\u2022", Recipe.Instructions); }); IngredientsClicked = new Command(() => { RecipeContent = String.Concat("\u2022", Recipe.Ingredients); }); System.Diagnostics.Debug.WriteLine("Set up ViewModel"); }
public UserViewModel() { navManager = PageNavigationManager.Instance; userManager = UserManager.DefaultManager; recipeManager = RecipeManager.DefaultManager; //User = Classes.GlobalVariables.selectedUser; //UserName = User.FirstName + User.LastName; //recipes = recipeManager.GetUserRecipesAsync(User.Email).Result; FollowClicked = new Command(() => { navManager.showUserPage(); }); RecipeClicked = new Command(() => { navManager.showRecipePage(); }); }
//public String Name{ // get { return name; } // set { // name = value; // OnPropertyChanged("Name"); // } //} //public String Description { // get { return description; } // set { // description = value; // OnPropertyChanged(); // } //} public AddRecipeViewModel() { manager = RecipeManager.DefaultManager; AddRecipeClicked = new Command(() => { Recipe newRecipe = new Recipe(); newRecipe.RecipeName = Recipe.RecipeName; newRecipe.RecipeName = "eggs"; newRecipe.Ingredients = "eggs"; newRecipe.Instructions = "whip eggs"; newRecipe.Email = "*****@*****.**"; //newRecipe.ImageURL = ""; //newRecipe.Description = Recipe.Description; //newRecipe.Instructions = Instructions; //newRecipe.Ingredients = Ingredients; //newRecipe = Recipe; //Debug.WriteLine(newRecipe.Description); Debug.WriteLine(Recipe.RecipeName); Debug.WriteLine(Recipe.Ingredients); Debug.WriteLine(Recipe.Instructions); try { RegisterRecipe(newRecipe); Debug.WriteLine("Added Recipe successfully"); } catch (Exception ex) { Debug.WriteLine(ex.Message.ToString()); } }); }
public FeedViewModel() { userManager = UserManager.DefaultManager; recipeManager = RecipeManager.DefaultManager; navManager = PageNavigationManager.Instance; //recipe1.RecipeName = "Butter Chicken"; //recipe1.Ingredients = "Chicken breasts, Coriander, Garam masala, Brown onion, Tomato puree, Chicken stock, Thickened cream, Basmati rice"; //recipe1.Description = "A simple and easy butter chicken recipe for beginners"; //recipe1.Instructions = "Marinate chicken in herb mixture, cook onion, cook chicken, add cream, simmer, cook rice, serve"; //recipe1.Email = "*****@*****.**"; //recipe2.RecipeName = "Spaghetti Bolognese"; //recipe2.Ingredients = "Beef mince, Angel hair spaghetti, Tomato paste, Chunky tomato, Carrot, Zucchini, Brown onion, Parmesan cheese"; //recipe2.Description = "A classic spaghetti bolognese big enough for the whole family"; //recipe2.Instructions = "Sautee onion, cook mince, add carrot and zucchini, add tomato paste and chunky tomato, simmer, cook spaghetti, serve topped with parmesan cheese"; //recipe2.Email = "*****@*****.**"; //recipe3.RecipeName = "Asian Chicken Stir-Fry"; //recipe3.Ingredients = "Sliced chicken breasts, capsicum, soy sauce, broccoli, carrot, noodles"; //recipe3.Description = "A basic asian-style chicken stir-fry"; //recipe.Instructions = "Cook chicken, cook broccoli and carrot, add soy sauce, add capsicum, cook noodles, serve"; //recipe3.Email = "*****@*****.**"; //user1.FirstName = "Joe"; //user1.LastName = "Bloggs"; //user1.Email = "*****@*****.**"; //user2.FirstName = "Jane"; //user2.LastName = "Doe"; //user2.Email = "*****@*****.**"; //user3.FirstName = "John"; //user3.LastName = "Smith"; //user3.Email = "*****@*****.**"; //recipes.Add(recipe1); //recipes.Add(recipe2); //recipes.Add(recipe3); //users.Add(user1); //users.Add(user2); //users.Add(user3); //UserName = FindUsername(users); //users = userManager.GetUsersAsync().Result; //recipes = recipeManager.GetRecipesAsync().Result; UserClicked = new Command(() => { navManager.showUserPage(); }); RecipeClicked = new Command(() => { navManager.showRecipePage(); }); AddClicked = new Command(() => { navManager.ShowAddRecipePage(); }); }