private void bestGenomeToolStripMenuItem_Click(object sender, EventArgs e) { IGuiNeatExperiment experiment = GetSelectedExperiment(); AbstractGenomeView genomeView = experiment.CreateGenomeView(); if(null == genomeView) { return; } // Create form. _bestGenomeForm = new GenomeForm("Best Genome", genomeView, _ea); // Attach a event handler to update this main form when the genom form is closed. _bestGenomeForm.FormClosed += new FormClosedEventHandler(delegate(object senderObj, FormClosedEventArgs eArgs) { _bestGenomeForm = null; bestGenomeToolStripMenuItem.Enabled = true; }); // Prevent creating more then one instance fo the form. bestGenomeToolStripMenuItem.Enabled = false; // Show the form. _bestGenomeForm.Show(this); _bestGenomeForm.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; } }