Changeset - 50bbf5233575
[Not reviewed]
default
0 1 0
Jason Maltzen (jmaltzen) - 6 years ago 2018-05-18 18:06:20
jason.maltzen@unsanctioned.net
Make the parameters to recipe generation more readable in code.
1 file changed with 12 insertions and 1 deletions:
0 comments (0 inline, 0 general)
UI/RecipeGeneratorView.cs
Show inline comments
...
 
@@ -417,97 +417,108 @@ namespace DesertPaintLab
 
        }
 

	
 
        protected void OnBegin(object sender, EventArgs e)
 
        {
 
            minIngredientsSpinButton.Sensitive = false;
 
            maxIngredientsSpinButton.Sensitive = false;
 
            //TODO ExportToWikiAction.Sensitive = false;
 
            maxRecipeSpinButton.Sensitive = false;
 
            beginButton.Sensitive = false; // TODO: change to "pause"?
 
            stopResumeButton.Sensitive = true;
 
            fullQuantitySpinButton.Sensitive = false;
 
            fullQuantityDepthSpinButton.Sensitive = false;
 
            reagentListView.Sensitive = false;
 
            checkButtonRibbon.Sensitive = false;
 

	
 
            countLabel.Text = String.Format("{0} / {1}", checkButtonRibbon.Active ? profile.RibbonCount : profile.RecipeCount, Palette.Count);
 

	
 
            // TODO: hook up event notifications
 
            // - progress
 
            // - complete
 
            // - new recipe / recipe update
 

	
 
            // Total recipe search count
 
            //int current = ReagentManager.Names.Count;
 
            //long recipePermutations = 1;
 
            //for (int i = 0; i < maxIngredientsSpinButton.ValueAsInt; ++i)
 
            //{
 
            //    recipePermutations *= current;
 
            //    --current;
 
            //}
 
            //System.Console.WriteLine("Will search {0} reagent permutations.", recipePermutations);
 

	
 
            lastProgressUpdate = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 
            lastStatusUpdate = lastProgressUpdate;
 

	
 
            lastProfileSave = lastProgressUpdate;
 
            lastCheckpoint = lastProgressUpdate;
 

	
 
            running = true;
 
            canceling = false;
 
            pauseForCheckpoint = false;
 
            stopResumeButton.Label = "Pause";
 

	
 
            if (Started != null)
 
            {
 
                Started(this, null);
 
            }
 

	
 
            generator.BeginRecipeGeneration((uint)(checkButtonRibbon.Active ? PaintRecipe.RIBBON_RECIPE_MIN_CONCENTRATION : PaintRecipe.PAINT_RECIPE_MIN_CONCENTRATION), (uint)maxRecipeSpinButton.ValueAsInt, (uint)minIngredientsSpinButton.Value, (uint)maxIngredientsSpinButton.ValueAsInt, (uint)fullQuantityDepthSpinButton.ValueAsInt, (uint)fullQuantitySpinButton.ValueAsInt);
 
            uint minConcentration = (uint)(checkButtonRibbon.Active ? PaintRecipe.RIBBON_RECIPE_MIN_CONCENTRATION : PaintRecipe.PAINT_RECIPE_MIN_CONCENTRATION);
 
            uint maxConcentration = (uint)maxRecipeSpinButton.ValueAsInt;
 
            uint minIngredients = (uint)minIngredientsSpinButton.Value;
 
            uint maxIngredients = (uint)maxIngredientsSpinButton.ValueAsInt;
 
            uint fullQuantityDepth = (uint)fullQuantityDepthSpinButton.ValueAsInt;
 
            uint fullQuantity = (uint)fullQuantitySpinButton.ValueAsInt;
 
            generator.BeginRecipeGeneration(minConcentration, 
 
                                            maxConcentration, 
 
                                            minIngredients, 
 
                                            maxIngredients, 
 
                                            fullQuantityDepth, 
 
                                            fullQuantity);
 
        }
 

	
 
        protected void OnStopResume(object sender, EventArgs e)
 
        {
 
            if (generator != null)
 
            {
 
                if (running)
 
                {
 
                    canceling = true;
 
                    pauseForCheckpoint = false;
 
                    generator.Stop();
 
                }
 
                else
 
                {
 
                    // Resume previous run
 
                    //TODO ExportToWikiAction.Sensitive = false;
 
                    reagentListView.Sensitive = false;
 
                    minIngredientsSpinButton.Sensitive = false;
 
                    maxIngredientsSpinButton.Sensitive = false;
 
                    maxRecipeSpinButton.Sensitive = false;
 
                    beginButton.Sensitive = false;
 
                    stopResumeButton.Sensitive = true;
 
                    fullQuantitySpinButton.Sensitive = false;
 
                    fullQuantityDepthSpinButton.Sensitive = false;
 
                    reagentListView.Sensitive = false;
 
                    checkButtonRibbon.Sensitive = false;
 

	
 
                    lastProgressUpdate = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
 
                    lastStatusUpdate = lastProgressUpdate;
 
                    lastProfileSave = lastProgressUpdate;
 
                    lastCheckpoint = lastProgressUpdate;
 

	
 
                    canceling = false;
 
                    pauseForCheckpoint = false;
 
                    running = true;
 
        
 
                    stopResumeButton.Label = "Pause";
 

	
 
                    if (Started != null)
 
                    {
 
                        Started(this, null);
 
                    }
 
                    generator.ResumeRecipeGeneration();
 
                }
 
            }
 
        }
 

	
 
        private void HandleFinished()
0 comments (0 inline, 0 general)