/// <summary> /// Delete the selected plug-in from the project /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnDelete_Click(object sender, EventArgs e) { string key = (string)lbProjectPlugIns.SelectedItem; int idx = lbProjectPlugIns.SelectedIndex; if (currentConfigs.ContainsKey(key)) { currentConfigs.Remove(key); currentConfigs.OnDictionaryChanged(new ListChangedEventArgs( ListChangedType.ItemDeleted, -1)); lbProjectPlugIns.Items.RemoveAt(idx); if (lbProjectPlugIns.Items.Count == 0) { btnConfigure.Enabled = btnDelete.Enabled = false; } else if (idx < lbProjectPlugIns.Items.Count) { lbProjectPlugIns.SelectedIndex = idx; } else { lbProjectPlugIns.SelectedIndex = idx - 1; } } }
/// <summary> /// Delete the selected plug-in from the project /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnDelete_Click(object sender, EventArgs e) { string key = (string)lbProjectPlugIns.SelectedItem; int idx = lbProjectPlugIns.SelectedIndex; if (currentConfigs.ContainsKey(key)) { currentConfigs.Remove(key); this.IsDirty = true; lbProjectPlugIns.Items.RemoveAt(idx); if (lbProjectPlugIns.Items.Count == 0) { btnConfigure.Enabled = btnDelete.Enabled = false; } else if (idx < lbProjectPlugIns.Items.Count) { lbProjectPlugIns.SelectedIndex = idx; } else { lbProjectPlugIns.SelectedIndex = idx - 1; } } }
/// <summary> /// Delete the selected plug-in from the project /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnDelete_Click(object sender, RoutedEventArgs e) { var config = (PlugInConfig)lbProjectPlugIns.SelectedItem; if (config != null && currentConfigs.ContainsKey(config.Name)) { currentConfigs.Remove(config.Name); this.PlugInsModified?.Invoke(this, EventArgs.Empty); int idx = lbProjectPlugIns.SelectedIndex; lbProjectPlugIns.Items.RemoveAt(idx); if (lbProjectPlugIns.Items.Count == 0) { btnConfigure.IsEnabled = btnDelete.IsEnabled = false; } else if (idx < lbProjectPlugIns.Items.Count) { lbProjectPlugIns.SelectedIndex = idx; } else { lbProjectPlugIns.SelectedIndex = idx - 1; } } }