private void problemDomainToolStripMenuItem_Click(object sender, EventArgs e) { IGuiNeatExperiment experiment = GetSelectedExperiment(); AbstractDomainView domainView = experiment.CreateDomainView(); if(null == domainView) { return; } // Create form. _domainForm = new ProblemDomainForm(experiment.Name, domainView, _ea); // Attach a event handler to update this main form when the domain form is closed. _domainForm.FormClosed += new FormClosedEventHandler(delegate(object senderObj, FormClosedEventArgs eArgs) { _domainForm = null; problemDomainToolStripMenuItem.Enabled = true; }); // Prevent creating more then one instance fo the form. problemDomainToolStripMenuItem.Enabled = false; // Show the form. _domainForm.Show(this); _domainForm.RefreshView(); }
private void cmbExperiments_SelectedIndexChanged(object sender, EventArgs e) { // Nullify this variable. We get the selected experiment via GetSelectedExperiment(). That method will instantiate // _selectedExperiment with the currently selected experiment (on-demand instantiation). _selectedExperiment = null; // Close any experiment specific forms that remain open. if(null != _bestGenomeForm) { _bestGenomeForm.Close(); _bestGenomeForm = null; } if(null != _domainForm) { _domainForm.Close(); _domainForm = null; } }