private void btnGenFull_Click(object sender, EventArgs e) { var amount = Convert.ToInt32(TbAmount.Text); var mbr = MessageBox.Show("Generate '" + amount + "' Systems?", "Sure?", MessageBoxButton.YesNo); if (mbr != MessageBoxResult.Yes) { return; } var start = DateTime.Now; for (var i = 0; i < amount; i++) { var ss = new StarSystem(); var d = new Dice(); var cs = new CreateStars(ss, d); ss = cs.CreateNewSystem(); SqlManager.InsertSystem(ss); } var finish = DateTime.Now; var span = finish - start; MessageBox.Show("Done! Took: " + span.Seconds + "s and " + span.Milliseconds + "ms"); }
/// <summary> /// This refreshes the DataGridView for displaying stars /// </summary> /// <summary> /// Begin Step 1 - generating the base system and stars, then displays them /// </summary> /// <param name="sender">The sender object</param> /// <param name="e">The event arguments</param> private void btnGenStars_Click(object sender, EventArgs e) { CreateStarsFinished = false; //clear the tables. if (OurSystem.CountStars() > 0) { OurSystem.ClearPlanets(); PlanetTable.Clear(); OurSystem.SysStars.Clear(); StarTable.Clear(); } var nCs = new CreateStars(OurSystem, VelvetBag, this); //register a closed event here. nCs.Closing += createStars_Closed; nCs.ShowDialog(); }