private void btnRecalc_Click(object sender, EventArgs e) { if (btnRecalc.Enabled) { btnRecalc.Enabled = false; try { double channel = Decimal.ToDouble(channelWide.Value); t = new Timer(); t.Tick += new EventHandler(t_Tick); t.Interval = 100; t.Start(); pc = new ParcourGenerator(); lock (activeParcour) { pc.RecalcParcour(activeParcour, c, channel); } PictureBox1.Invalidate(); } catch (Exception ex) { btnRecalc.Enabled = true; MessageBox.Show(ex.Message, "Error while generating Parcour"); } } }
private void btnGenerate_Click(object sender, EventArgs e) { btnGenerate.Enabled = false; try { double lenght = Decimal.ToDouble(parcourLength.Value); double channel = Decimal.ToDouble(channelWide.Value); int count = Decimal.ToInt32(corridorCount.Value); t = new Timer(); t.Tick += new EventHandler(t_Tick); t.Interval = 100; t.Start(); pc = new ParcourGenerator(); pc.GenerateParcour(activeParcour, c, lenght, channel, count); PictureBox1.Invalidate(); } catch (Exception ex) { btnGenerate.Enabled = true; MessageBox.Show(ex.Message, "Error while generating Parcour"); } }