private void Form1_Load(object sender, EventArgs e) { prm = new Params(); move = new Movement(); bsgraph = new BindingSource(); datastore = new List<Movement>(); //setup the parameters - call the extra windows form frmParameters p = new frmParameters(); //user can use preset values p.Param_data.Buckets = 5; p.Param_data.Inflow = 10; p.Param_data.Outflow = 1; p.Finaltime = 10; p.Movement.Omega = 0.1f; DialogResult d = p.ShowDialog(); //or set is own one if (d == DialogResult.OK) { prm.Buckets = p.Param_data.Buckets; prm.Inflow = p.Param_data.Inflow; prm.Outflow = p.Param_data.Outflow; finaltime = p.Finaltime; move.Omega = p.Movement.Omega; } else if (d == DialogResult.Cancel) { prm.Buckets = 5; prm.Theta = 0; prm.Inflow = 10; prm.Outflow = 1; finaltime = 10; move.Omega = 0.1f; } //setup the transform for painting SetupTransform(); //initialize the picture r = 40; cX = 50; cY = 50; //initialize the list of buckets buckets = new List<Bucket>(); for (int i = 0; i < prm.Buckets; i++) { b = new Bucket(0); buckets.Add(b); } //initialize the timer timer = new Timer(); timer.Tick += frm_Tick; timer.Interval = 50; //the text boxes... txtUpDownBuckets.DataBindings.Add("Text", prm, "Buckets"); txtMass.DataBindings.Add("Text", prm, "Mass"); txtTheta.DataBindings.Add("Text", prm, "Theta"); txtUpDownBuckets.Maximum = limitbucket; txtUpDownBuckets.Minimum = 0; textBox1.Visible = false; rbNormal.Checked = true; }
public frmParameters() { InitializeComponent(); param_data = new Params(); movement = new Movement(); }