Changeset - ca4042a2cbb4
[Not reviewed]
Jason Maltzen (jmaltzen) - 9 years ago 2016-01-23 20:18:34
jason.maltzen@unsanctioned.net
Update recipe information display if the currently-selected recipe changes.
1 file changed with 31 insertions and 12 deletions:
0 comments (0 inline, 0 general)
RecipeGeneratorWindow.cs
Show inline comments
...
 
@@ -414,5 +414,5 @@ namespace DesertPaintLab
 
                if (!exists)
 
                {
 
                    //Console.WriteLine("Add new recipe for {0}", args.Color);
 
                    //Console.WriteLine("Add new recipe for {0}", recipeColor);
 
                    //    bool isMissingReactions = args.Recipe.CheckMissingReactions(ref missingReactions);
 
                    //    string missingReactionLabel = isMissingReactions ? "X" : "";
...
 
@@ -420,4 +420,8 @@ namespace DesertPaintLab
 
                    countLabel.Text = String.Format("{0} / {1}", profile.RecipeCount+1, Palette.Count);
 
                }
 
                //else
 
                //{
 
                //    Console.WriteLine("Updated recipe for {0}", recipeColor);
 
                //}
 
                profile.SetRecipe(recipe);
 
    
...
 
@@ -429,4 +433,14 @@ namespace DesertPaintLab
 
                    lastProfileSave = progressTime;
 
                }
 
                Gtk.TreeModel model;
 
                Gtk.TreeSelection selection = recipeList.Selection;
 
                if ((selection != null) && selection.GetSelected(out model, out iter))
 
                {
 
                    string colorName = (string)colorStore.GetValue(iter, 0);
 
                    if (colorName.Equals(recipeColor))
 
                    {
 
                        ShowColor(recipe);
 
                    }
 
                }
 
            }
 
        }
...
 
@@ -473,4 +487,19 @@ namespace DesertPaintLab
 
        }
 

	
 
        private void ShowColor(PaintRecipe recipe)
 
        {
 
            Gtk.ListStore store = (Gtk.ListStore)recipeIngredientsView.Model;
 
            store.Clear();
 
            if (recipe.CheckMissingReactions(ref missingReactions))
 
            {
 
                statusLabel.Text = "WARNING: This recipe includes reactions that have not yet been recorded.";
 
            }
 
            foreach (PaintRecipe.RecipeIngredient ingredient in recipe.Ingredients)
 
            {
 
                store.AppendValues(ingredient.quantity.ToString(), ingredient.name);
 
            }
 
            paintSwatch.Color = recipe.ReactedColor;
 
        }
 

	
 
        protected void OnColorSelected(object o, EventArgs args)
 
        {
...
 
@@ -484,16 +513,6 @@ namespace DesertPaintLab
 
                if (profile.Recipes.TryGetValue(colorName, out recipe))
 
                {
 
                    Gtk.ListStore store = (Gtk.ListStore)recipeIngredientsView.Model;
 
                    store.Clear();
 
                    if (recipe.CheckMissingReactions(ref missingReactions))
 
                    {
 
                        statusLabel.Text = "WARNING: This recipe includes reactions that have not yet been recorded.";
 
                    }
 
                    foreach (PaintRecipe.RecipeIngredient ingredient in recipe.Ingredients)
 
                    {
 
                        store.AppendValues(ingredient.quantity.ToString(), ingredient.name);
 
                    }
 
                    ShowColor(recipe);
 
                }
 
                paintSwatch.Color = recipe.ReactedColor;
 
            }
 
        }
0 comments (0 inline, 0 general)