private void CreateButton_Click(object sender, EventArgs e) { int count = this.timersListBox.Items.Count; if (count == 0 && !this.arrivalTimerCheckbox.Checked) { Util.MessageBox("Please select at least one timer."); return; } string[] niceNames = new string[count]; this.timersListBox.Items.CopyTo(niceNames, 0); TimerControl.TimerType[] toCreateTypes = niceNames.Select( name => this.allTypes[Array.IndexOf(this.allNiceNames, name)]).ToArray(); TimerBaseForm.CreateWithTimerTypes(toCreateTypes, this.arrivalTimerCheckbox.Checked, this.worksheet, Properties.Resources.customTimersTitle).Show(); this.created = true; this.Dispose(); }