/// <summary>
        /// Reset the configuration of the selected component
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnReset_Click(object sender, EventArgs e)
        {
            string id = (string)lbComponents.SelectedItem;

            if (currentConfigs.ContainsKey(id))
            {
                currentConfigs.Remove(id);
                currentConfigs.OnDictionaryChanged(
                    new ListChangedEventArgs(
                        ListChangedType.ItemDeleted, -1));

                lbComponents.Invalidate();
                lbComponents.Update();
            }
        }
        /// <summary>
        /// Delete the selected build component 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)lbProjectComponents.SelectedItem;
            int    idx = lbProjectComponents.SelectedIndex;

            if (currentConfigs.ContainsKey(key))
            {
                currentConfigs.Remove(key);
                this.IsDirty = true;

                lbProjectComponents.Items.RemoveAt(idx);

                if (lbProjectComponents.Items.Count == 0)
                {
                    btnConfigure.Enabled = btnDelete.Enabled = false;
                }
                else
                if (idx < lbProjectComponents.Items.Count)
                {
                    lbProjectComponents.SelectedIndex = idx;
                }
                else
                {
                    lbProjectComponents.SelectedIndex = idx - 1;
                }
            }
        }
        /// <summary>
        /// Delete the selected build component 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 = (ComponentConfig)lbProjectComponents.SelectedItem;

            if (config != null && currentConfigs.ContainsKey(config.Name))
            {
                currentConfigs.Remove(config.Name);
                this.ComponentsModified?.Invoke(this, EventArgs.Empty);

                int idx = lbProjectComponents.SelectedIndex;
                lbProjectComponents.Items.RemoveAt(idx);

                if (lbProjectComponents.Items.Count == 0)
                {
                    btnConfigure.IsEnabled = btnDelete.IsEnabled = false;
                }
                else
                if (idx < lbProjectComponents.Items.Count)
                {
                    lbProjectComponents.SelectedIndex = idx;
                }
                else
                {
                    lbProjectComponents.SelectedIndex = idx - 1;
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Delete the selected build component 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)lbProjectComponents.SelectedItem;
            int    idx = lbProjectComponents.SelectedIndex;

            if (currentConfigs.ContainsKey(key))
            {
                currentConfigs.Remove(key);
                currentConfigs.OnDictionaryChanged(new ListChangedEventArgs(
                                                       ListChangedType.ItemDeleted, -1));

                lbProjectComponents.Items.RemoveAt(idx);

                if (lbProjectComponents.Items.Count == 0)
                {
                    btnConfigure.Enabled = btnDelete.Enabled = false;
                }
                else
                if (idx < lbProjectComponents.Items.Count)
                {
                    lbProjectComponents.SelectedIndex = idx;
                }
                else
                {
                    lbProjectComponents.SelectedIndex = idx - 1;
                }
            }
        }