Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 internal RecipeViewModel(RecipeListViewModel owner, string id, string name)
     : this(owner, id, name, new Amount(), Arrays <IngredientReference> .Empty)
 {
 }
Esempio n. 4
0
 internal RecipeViewModel(RecipeListViewModel owner, Recipe recipe)
     : this(owner, recipe.ID, recipe.Name, recipe.Amount, recipe.Ingredients)
 {
 }