Changeset - 5e28ba3945f7
[Not reviewed]
default
0 1 0
Jason Maltzen - 3 years ago 2021-09-10 00:03:21
jason@hiddenachievement.com
Recipe count is now a ulong instead of an int so it can show values > 2.47 billion. Also, don't allow clearing the recipe list while the recipe generator is running.
1 file changed with 12 insertions and 6 deletions:
0 comments (0 inline, 0 general)
ViewModels/RecipeGeneratorViewModel.cs
Show inline comments
...
 
@@ -92,3 +92,3 @@ namespace DesertPaintCodex.ViewModels
 
        private readonly ConcurrentQueue<PaintRecipe> _pendingNewRecipes = new();
 
        private volatile int _newRecipeCount;
 
        private ulong _newRecipeCount;
 
        private volatile bool _updatesAvailable;
...
 
@@ -157,2 +157,4 @@ namespace DesertPaintCodex.ViewModels
 

	
 
            CanClear = false;
 

	
 
            _generator.BeginRecipeGeneration(
...
 
@@ -203,2 +205,3 @@ namespace DesertPaintCodex.ViewModels
 

	
 
            CanClear = false;
 
            _generator.ResumeRecipeGeneration();
...
 
@@ -301,3 +304,3 @@ namespace DesertPaintCodex.ViewModels
 
        {
 
            _newRecipeCount = (int)_generator.RecipeCount;
 
            _newRecipeCount = _generator.RecipeCount;
 
            _updatesAvailable = true;
...
 
@@ -315,2 +318,3 @@ namespace DesertPaintCodex.ViewModels
 
        {
 
            Debug.WriteLine($"Generator stopped. Saving = {_saving}");
 
            if (_saving)
...
 
@@ -348,3 +352,4 @@ namespace DesertPaintCodex.ViewModels
 
            // Update test count.
 
            PermutationCount = $"{_newRecipeCount:n0}";
 
            ulong newRecipeCount = _newRecipeCount;
 
            PermutationCount = $"{newRecipeCount:n0}";
 
            
...
 
@@ -389,2 +394,6 @@ namespace DesertPaintCodex.ViewModels
 
            {
 
                Debug.WriteLine("Saving generator state.");
 
                _saving = true;
 
                _generator.Stop();
 

	
 
                _profile.SaveRecipes();
...
 
@@ -392,5 +401,2 @@ namespace DesertPaintCodex.ViewModels
 
            }
 

	
 
            _saving = true;
 
            _generator.Stop();
 
        }
0 comments (0 inline, 0 general)