async Task ExecuteLoadIngredientCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                IngredientList.Clear();
                var items = await DataStore.GetItemAsync(Item.Id);

                foreach (var ingredient in items.IngredientList)
                {
                    IngredientList.Add(ingredient);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #2
0
 //Czyszczenie pól
 public void ClearPage()
 {
     DescriptionTxt = "";
     TitleTxt       = "";
     AuthorTxt      = "";
     IngredientList.Clear();
     SelectedCategoryCB.ID = 0;
     SelectedQuantityCB    = "Szklanka";
 }
 public void PopulateBindingLists()
 {
     IngredientList.Clear();
     IngredientQuantities.Clear();
     foreach (var kvp in PantryContents)
     {
         IngredientList.Add(kvp.Key);
         IngredientQuantities.Add(kvp.Value);
     }
 }
        public void PopulateIngredientList()
        {
            IngredientList.Clear();
            MealPlan mealPlan = new MealPlan();

            foreach (Ingredient i in mealPlan.Ingredients)
            {
                IngredientModel item = new IngredientModel(i.IngredientName, i.IngredientID, i.PricePerPack, i.NumberInPack);
                IngredientList.Add(item);
            }
        }
Example #5
0
        public void PopulateIngredientList(MealModel m)
        {
            IngredientList.Clear();
            if (m != default(MealModel))
            {
                MealPlan           mealPlan   = new MealPlan();
                IEnumerable <Meal> chosenMeal = from meal in mealPlan.Meals
                                                where meal.MealName == m.Name
                                                select meal;

                foreach (var meal in chosenMeal)
                {
                    ICollection <Ingredient> chosenIngredients = meal.Ingredients;
                    foreach (var ci in chosenIngredients)
                    {
                        IngredientModel im = new IngredientModel(ci.IngredientName, ci.IngredientID, ci.PricePerPack, ci.NumberInPack);
                        IngredientList.Add(im);
                    }
                }
            }
        }