GenerateDesignRecipeBox()
        {
            RecipeBox rb = new RecipeBox();
            rb.Name = "Design Only";
            rb.Description = "Design time data margely bargely doogely doo";
            for (int i = 0; i < 4; i++)
            {
                RecipeGroup recipeGroup = new RecipeGroup();
                recipeGroup.Name = "Group " + i;
                for (int k = 0; k < 8; k++)
                {
                    Recipe r = new Recipe();
                    r.Name = "Recipe " + i + k;
                    r.Description = "The Recipe description is going here";

                    
                    Ingredient flour = new Ingredient("Flour", IngredientType.Dry);
                    flour.AdjustPercent(65);
                    r.AddIngredient(flour);

                    Ingredient water = new Ingredient("Water", IngredientType.Wet);
                    water.AdjustPercent(25);
                    r.AddIngredient(water);

                    Ingredient group = new Ingredient();
                    group.Name = "Starter";
                    group.AdjustPercent(10);

                    Ingredient flour2 = new Ingredient("Flour", IngredientType.Dry);
                    flour2.AdjustPercent(75);
                    r.AddIngredient(group);
                    group.AddIngredient(flour2);

                    Ingredient water2 = new Ingredient("Water", IngredientType.Wet);
                    water2.AdjustPercent(25);
                    group.AddIngredient(water2);
                    r.TotalWeight = 1000;

                    Step step = new Step();
                    step.Description =
                        "Here is some direction on how to do some shit when your doing those things you do with the stuff  and all that crap...You now have killer direction and such";
                    r.Steps.Add(step);
                    r.Steps.Add(new Step("Here is another step that you'll need to follow"));
                    r.BalancePercentages();

                    recipeGroup.Recipes.Add(r);
                }
                rb.RecipeGroups.Add(recipeGroup);
            }
            return rb;
        }
Esempio n. 2
0
        private static RecipeBox GenerateDefaultRecipeBox()
        {
            Recipe r = new Recipe();
            r.Name = "Sourdough";
            Ingredient flour = new Ingredient("Flour", IngredientType.Dry);
            flour.AdjustPercent(65);
            r.AddIngredient(flour);

            Ingredient water = new Ingredient("Water", IngredientType.Wet);
            water.AdjustPercent(25);
            r.AddIngredient(water);

            Ingredient group = new Ingredient();
            group.Name = "Starter";
            group.AdjustPercent(10);

            Ingredient flour2 = new Ingredient("Flour", IngredientType.Dry);
            flour2.AdjustPercent(75);
            r.AddIngredient(group);
            group.AddIngredient(flour2);

            Ingredient water2 = new Ingredient("Water", IngredientType.Wet);
            water2.AdjustPercent(25);
            group.AddIngredient(water2);
            r.TotalWeight = 1000;

            Step step = new Step();
            step.Description =
                "Here is some direction on how to do some shit when your doing those things you do with the stuff  and all that crap...You now have killer direction and such";
            r.Steps.Add(step);
            r.BalancePercentages();

            Recipe r2 = new Recipe();
            r2.Name = "Jimmy Gabooty";
            Ingredient pasta = new Ingredient("pasta", IngredientType.Dry);
            pasta.AdjustPercent(65);
            r2.AddIngredient(pasta);
            Ingredient milk = new Ingredient("Milk", IngredientType.Wet);
            milk.AdjustPercent(35);
            r2.AddIngredient(milk);
            r2.TotalWeight = 1000;
            RecipeBox rb = new RecipeBox();
            rb.Name = "Default";
            RecipeGroup recipeGroup = new RecipeGroup();
            recipeGroup.Name = "Group";
            recipeGroup.Recipes.Add(r);
            recipeGroup.Recipes.Add(r2);
            rb.RecipeGroups.Add(recipeGroup);
            return rb;
        }
        public static void AdjustItemWeights(Ingredient sender, double newWeight,  ObservableCollection<Ingredient> items )
        {
            double oldWeight = sender.GetExactWeight();
            double weightAdjustRatio = newWeight / oldWeight;
            

            for (int i = 0; i < items.Count; i++)
            {
                Ingredient ingredient = items[i];
                double updatedWeight = ingredient.GetExactWeight() * weightAdjustRatio;
                ingredient.AdjustWeight(updatedWeight);
                
            }
            
        }
Esempio n. 4
0
 public bool DeleteChild(Ingredient child)
 {
     bool found = false;
     if (ingredients.Contains(child))
     {
         ingredients.Remove(child);
         BalancePercentages();
         return true;
     }
     foreach (var ingredient in ingredients)
     {
         found = ingredient.DeleteChild(child);
         if (found) break;
     }
     return found;
 }
Esempio n. 5
0
        public bool AddIngredient(Ingredient add)
        {
            if (ingredients == null) ingredients = new ObservableCollection<Ingredient>();
            if (ingredients.Any(i => i.Name == add.Name)) return false;


            add.PercentChanged += AdjustIngredientPercentages;
            add.WeightChanged += WeightChanged;
            add.UpdateHydration += UpdateHydration;
            add.EntryModeChange += ChildEnteredEntryMode;
            Ingredients.Add(add);
            BalancePercentages();
            ShowChildren = true;
            RaisePropertyChanged("Ingredients");
            return true;
        }
Esempio n. 6
0
 public void ChildEnteredEntryMode(Ingredient sender, bool onOff)
 {
     foreach (var ingredient in ingredients)
     {
         if (ingredient == sender) continue;
         ingredient.DisableRatios = onOff;
         ingredient.DisableWeight = onOff;
         if(onOff) ingredient.FreezeChildren();
         else ingredient.UnFreezeChildren();
         if (EntryModeChange != null) EntryModeChange(this, onOff);
     }
 }
 private void newIngredient()
 {
     NewIngredientDialog nd = new NewIngredientDialog();
     nd.Title = "Enter Ingredient Name";
     nd.TypeList.ItemsSource = ingredientTypes.Keys;
     nd.TypeList.SelectedIndex = 0;
     nd.NameTextBox.Focus();
     nd.ShowDialog();
     IngredientType type = ingredientTypes[nd.TypeList.SelectedItem.ToString()];
     Ingredient newIngredient = new Ingredient(nd.NameTextBox.Text, type);
     CurrentRecipe.AddIngredient(newIngredient);
     newIngredient.UpdateHydration += currentRecipe.CalculateHydration;
     currentRecipe.CalculateHydration();
 }
 public void deleteIngredient(Ingredient ingredient)
 {
     if (currentRecipe.Ingredients.Contains(ingredient))
     {
         currentRecipe.DeleteIngredient(ingredient);
         return;
     }
     //__ingredient not found at top level, search children
     foreach (var item in currentRecipe.Ingredients)
     {
         if (item.DeleteChild(ingredient)) break;
     }
 }
        private void newChildIngredient(Ingredient group)
        {
            NewIngredientDialog nd = new NewIngredientDialog();
            nd.Title = "Enter Ingredient Name";
            nd.TypeList.ItemsSource = ingredientTypes.Keys;
            nd.TypeList.SelectedIndex = 0;
            nd.NameTextBox.Focus();
            nd.ShowDialog();

            IngredientType type = ingredientTypes[nd.TypeList.SelectedItem.ToString()];
            Ingredient newIngredient = new Ingredient(nd.NameTextBox.Text, type);
            group.AddIngredient(newIngredient);
        }
Esempio n. 10
0
 public void AddIngredientWithWeight(Ingredient i)
 {
     LinkEvents(i);
     TotalWeight += i.Weight;
     Ingredients.Add(i);
     BalancePercentages();
 }
Esempio n. 11
0
        public static void SetChildWeightsFromPercentage( Ingredient parentIngredient)
        {
            var children = parentIngredient.Ingredients;
            if (children == null) return;
            double totalWeight = parentIngredient.GetExactWeight();

            foreach (var child in children) child.AdjustWeight(child.GetExactPercent() * totalWeight);

        }
Esempio n. 12
0
 public void ToggleChildEntryMode(Ingredient sender, bool doLock)
 {
     foreach (var ingredient in ingredients)
     {
         if (ingredient.Equals(sender)) continue;
         ingredient.DisableRatios = doLock;
         ingredient.DisableWeight = doLock;
         if (doLock) ingredient.FreezeChildren();
         else ingredient.UnFreezeChildren();
     }
 }
Esempio n. 13
0
 public void AdjustAllWeights(Ingredient sender, double newWeight)
 {
     if (disableRatioAdjustments) return;
     ValueAdjusters.AdjustItemWeights(sender, newWeight, ingredients);
     totalWeight = ingredients.Sum(i => i.GetExactWeight());
     RaisePropertyChanged("TotalWeight");
 }
Esempio n. 14
0
 public void DeleteIngredient(Ingredient ingredient)
 {
     if (ingredients.Contains(ingredient))
     {
         ingredients.Remove(ingredient);
         return;
     }
     BalancePercentages();
     RaisePropertyChanged("Ingredients");
 }
Esempio n. 15
0
 private void LinkEvents(Ingredient i)
 {
     i.PercentChanged += AdjustItemPercentages;
     i.WeightChanged += AdjustAllWeights;
     i.EntryModeChange += ToggleChildEntryMode;
 }
Esempio n. 16
0
        private RecipeBox GenerateDefaultRecipeBox()
        {
            RecipeBox rb = new RecipeBox();
            rb.Name = "Default";
            rb.Description = "A default set of basic recipes to get you started";
            RecipeGroup group = new RecipeGroup();
            group.Name = "Basic";

            #region build Flaxseed sourdough bread
            Ingredient FlaxSeed = new Ingredient("Flax Seed", IngredientType.Dry);
            FlaxSeed.Weight = 34;
            Ingredient Water = new Ingredient("Water", IngredientType.Wet);
            Water.Weight = 124;
            Ingredient SeedMix = new Ingredient("Flax Seed Mix", IngredientType.Miscellaneous);
            SeedMix.AddIngredient(FlaxSeed);
            SeedMix.AddIngredient(Water);            
            SeedMix.SetWeightFromChildren();

            Recipe flaxSeedRecipe = new Recipe("Flax Seed Sourdough");
            flaxSeedRecipe.Description = "Popped flax seeds give this bread a soft, interesting texture";
            flaxSeedRecipe.AddIngredientWithWeight(FlaxSeed);

            Ingredient starter = new Ingredient("Starter", IngredientType.Miscellaneous);
            Ingredient flour = new Ingredient("Bread Flour", IngredientType.Dry);
            flour.Weight = 21;
            Ingredient H20 = new Ingredient("Water", IngredientType.Wet);
            H20.Weight = 21;
            starter.AddIngredient(flour);
            starter.AddIngredient(H20);
            starter.SetWeightFromChildren();
            Ingredient levain = new Ingredient("Levain", IngredientType.Miscellaneous);
            levain.AddIngredient(starter);
            Ingredient levainWater = new Ingredient("Water", IngredientType.Wet);
            levainWater.Weight = 135;
            levain.AddIngredient(levainWater);
            Ingredient levainFlour = new Ingredient("Bread Flour", IngredientType.Dry);
            levain.AddIngredient(levainFlour);
            levain.SetWeightFromChildren();
            flaxSeedRecipe.AddIngredientWithWeight(levain);

            Ingredient finalFlour = new Ingredient("Bread Flour", IngredientType.Dry);
            finalFlour.Weight = 121;
            flaxSeedRecipe.AddIngredientWithWeight(finalFlour);
            Ingredient salt = new Ingredient("Salt", IngredientType.Salt);
            flaxSeedRecipe.AddIngredientWithWeight(salt);
            group.Recipes.Add(flaxSeedRecipe);
            #endregion

            Recipe buiscuit = new Recipe("Sourdough Biscuits");
            buiscuit.Description = "These need to rise for a long time, 18-24 hours preferably";
            Ingredient buiscuitStarter = new Ingredient("Starter", IngredientType.Miscellaneous);
            Ingredient buiscuitStarterFlour = new Ingredient("Flour", IngredientType.Dry);
            buiscuitStarterFlour.Weight = 58.5;
            buiscuitStarter.AddIngredient(buiscuitStarterFlour);
            Ingredient buiscuitStarterWater = new Ingredient("Water", IngredientType.Wet);
            buiscuitStarterWater.Weight = 58.5;
            buiscuitStarter.AddIngredient(buiscuitStarterWater);
            buiscuitStarter.BalancePercentages();
            buiscuit.AddIngredientWithWeight(buiscuitStarter);

            Ingredient buiscuitFlour = new Ingredient("AP Flour", IngredientType.Dry);
            buiscuitFlour.Weight = 222;
            buiscuit.AddIngredientWithWeight(buiscuitFlour);

            Ingredient sugar = new Ingredient("Sugar", IngredientType.Sweet);
            sugar.Weight = 5;
            buiscuit.AddIngredientWithWeight(sugar);

            Ingredient buiscuitSalt = new Ingredient("Salt", IngredientType.Salt);
            buiscuitSalt.Weight = 5;
            buiscuit.AddIngredientWithWeight(buiscuitSalt);

            Ingredient butter = new Ingredient("Butter", IngredientType.Fat);
            butter.Weight = 111;
            buiscuit.AddIngredientWithWeight(butter);

            Ingredient milk = new Ingredient("Milk", IngredientType.Wet);
            milk.Weight = 140;
            buiscuit.AddIngredientWithWeight(milk);
            group.Recipes.Add(buiscuit);

            rb.RecipeGroups.Add(group);
            return rb;
        }
Esempio n. 17
0
 public void AddIngredient(Ingredient i)
 {
     i.Percent = 1;
     LinkEvents(i);
     Ingredients.Add(i);
     BalancePercentages();
 }