Fixed the bug where the simulation would simply restart automatically

This commit is contained in:
2022-05-05 13:20:08 +02:00
parent f65b68ad92
commit 674eb9dc22
3 changed files with 19 additions and 19 deletions
@@ -110,6 +110,8 @@ namespace PropagationRemasteredBeta
if (infecteds > 0)
{
t.Refresh();
//Stopping and restarting timer makes sure that the processing of the image is finished before an other call is made
tmrTick.Start();
}
else
{
@@ -122,7 +124,8 @@ namespace PropagationRemasteredBeta
BufferImage = t.Display();
tmrTick.Start();
if (needToSave)
{
Save(BufferImage, frameCount);
@@ -138,10 +141,15 @@ namespace PropagationRemasteredBeta
//refresh all the stats
lblMemory.Text = GetMemoryUsage().ToString() + " Mb";
lblelementsCounter.Text = t.DRAWED_ELEMENTS.ToString();
//lblInfected.Text = t.InfectedCount[t.InfectedCount.Count() - 1].ToString();
//lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString();
//lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString();
//lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString();
if(t.InfectedCount.Count > 0)
lblInfected.Text = t.InfectedCount[t.InfectedCount.Count() - 1].ToString();
if (t.ImmuneCount.Count > 0)
lblImmunes.Text = t.ImmuneCount[t.ImmuneCount.Count() - 1].ToString();
if (t.SainCount.Count > 0)
lblSain.Text = t.SainCount[t.SainCount.Count() - 1].ToString();
if(t.DeadCount.Count > 0)
lblDeaths.Text = t.DeadCount[t.DeadCount.Count() - 1].ToString();
}
private void Save(Bitmap imageToSave, int frameNumber)
{