Images are now saved and you can have randomized values at the generation and a name can be chooen for the simulation

This commit is contained in:
2022-05-05 11:36:37 +02:00
parent beb4658c95
commit c8b38b5d6b
6 changed files with 331 additions and 184 deletions
+36 -2
View File
@@ -18,6 +18,9 @@ namespace PropagationRemasteredBeta
public int deathRate;
public int infectionRate;
public int cureTime;
public bool needToSave;
public string savesLocation;
public string simulationName;
public MainVue()
{
InitializeComponent();
@@ -30,17 +33,48 @@ namespace PropagationRemasteredBeta
private void btnRunSimulation_Click(object sender, EventArgs e)
{
terrainSize = new Size(Convert.ToInt32(nupPopulationSize.Value),Convert.ToInt32(nupPopulationSize.Value));
terrainSize = new Size(Convert.ToInt32(nupPopulationSize.Value), Convert.ToInt32(nupPopulationSize.Value));
infectedProportion = Convert.ToInt32(nupInfecteds.Value);
resistantProportion = Convert.ToInt32(nupImmunes.Value);
deathRate = Convert.ToInt32(nupMortality.Value);
infectionRate = Convert.ToInt32(nupInfectiosity.Value);
cureTime = Convert.ToInt32(nupCureTime.Value);
needToSave = chkbxSaveFiles.Checked;
simulationName = tbxSimulationName.Text;
savesLocation = tbxSaveFilePath.Text;
SimulationVue sm = new SimulationVue(terrainSize,infectedProportion,resistantProportion,deathRate,infectionRate,cureTime);
SimulationVue sm = new SimulationVue(terrainSize, infectedProportion, resistantProportion, deathRate, infectionRate, cureTime, needToSave, savesLocation, simulationName);
sm.Closed += (s, args) => this.Show();
sm.Show();
this.Hide();
}
private void nupPopulationSize_ValueChanged(object sender, EventArgs e)
{
decimal value = nupPopulationSize.Value;
lblPopulationSizePrediction.Text = (value * value).ToString();
}
private void Refresh()
{
nupInfecteds.Value = infectedProportion;
nupImmunes.Value = resistantProportion;
nupMortality.Value = deathRate;
nupInfectiosity.Value = infectionRate;
nupCureTime.Value = cureTime;
}
private void btnRandomizeStats_Click(object sender, EventArgs e)
{
Random rnd = new Random();
infectedProportion = rnd.Next(0, 80);
resistantProportion = rnd.Next(0, 80);
deathRate = rnd.Next(0, 80);
infectionRate = rnd.Next(0, 80);
cureTime = rnd.Next(0, 80);
Refresh();
}
private void btnOpenSimViewer_Click(object sender, EventArgs e)
{
}
}
}