internal RecipeViewModel(RecipeListViewModel owner, string id, string name, Amount amount, IEnumerable <IngredientReference> ingredients) { mOwner = owner; ID = id; Name = name; Amount = amount; Ingredients = ingredients.Select(i => new IngredientReferenceViewModel(owner.IngredientList, i)).ToArray(); Commit(); }
public SaveFileViewModel(ISaveFileService service) { ViewModelStack.Initialize(this); mService = service; var data = mService.ReadSaveFile(); Ingredients = new IngredientListViewModel(); foreach (var ingredient in data.Ingredients) { Ingredients.Items.Add(new IngredientViewModel(ingredient)); } Recipes = new RecipeListViewModel(Ingredients); foreach (var recipe in data.Recipes) { Recipes.Items.Add(new RecipeViewModel(Recipes, recipe)); } mSaveCommand = new DelegateCommand(DoSave); }
internal RecipeViewModel(RecipeListViewModel owner, string id, string name) : this(owner, id, name, new Amount(), Arrays <IngredientReference> .Empty) { }
internal RecipeViewModel(RecipeListViewModel owner, Recipe recipe) : this(owner, recipe.ID, recipe.Name, recipe.Amount, recipe.Ingredients) { }