private void buttonNew_Click(object sender, EventArgs e) { if (listViewIndicatorTypes.SelectedItems.Count == 0 || _pendingIndicator == null) { return; } _pendingIndicator.Initialize(_session.DataProvider); _session.Add(_pendingIndicator); if (AddIndicatorEvent != null) { AddIndicatorEvent(_pendingIndicator, GetSelectedPane()); } UpdateUI(); // Select the newly created indicator. this.listViewIndicators.Items[listViewIndicators.Items.Count - 1].Selected = true; this.listViewIndicators.Focus(); _pendingIndicator = null; // Invoke the creation of a new _pendingIndicator //listViewIndicatorTypes_SelectedIndexChanged(sender, e); // Select the newly created indicator. if (listViewIndicators.Items.Count > 0) { listViewIndicators.Items[listViewIndicators.Items.Count - 1].Selected = true; } listViewIndicators.Focus(); }