diff --git a/PaintRecipe.cs b/PaintRecipe.cs --- a/PaintRecipe.cs +++ b/PaintRecipe.cs @@ -58,6 +58,21 @@ namespace DesertPaintLab { } + public PaintRecipe(PaintRecipe other) + { + this.dirty = true; + this.reactions = other.reactions; + foreach (string reagentName in other.reagents) + { + this.reagents.Add(reagentName); + } + foreach (RecipeIngredient copyIngredient in other.recipe) + { + RecipeIngredient ingredient = new RecipeIngredient(copyIngredient.name, copyIngredient.quantity); + this.recipe.Add(ingredient); + } + } + public List Ingredients { get { diff --git a/RecipeGeneratorWindow.cs b/RecipeGeneratorWindow.cs --- a/RecipeGeneratorWindow.cs +++ b/RecipeGeneratorWindow.cs @@ -200,6 +200,7 @@ namespace DesertPaintLab protected void OnNewRecipe(object sender, NewRecipeEventArgs args) { + PaintRecipe recipe = new PaintRecipe(args.Recipe); // copy it Gtk.Application.Invoke(delegate { progressBar.Pulse(); @@ -226,7 +227,7 @@ namespace DesertPaintLab colorStore.AppendValues(args.Color); // , missingReactionLabel); countLabel.Text = String.Format("{0} / {1}", generator.Recipes.Count, Palette.Count); } - profile.SetRecipe(args.Recipe); + profile.SetRecipe(recipe); }); }