private void InstallComponentsList_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            // if it's 'readonly', keep it 'readonly'
            if (e.CurrentValue == CheckState.Indeterminate)
            {
                e.NewValue = CheckState.Indeterminate;
                return;
            }

            foreach (InstallerComponent component in InstallerComponents.Components)
            {
                // skip the component if it's not the one we need
                if (component.Name !=
                    InstallComponentsList.Items[e.Index].ToString())
                {
                    continue;
                }

                component.Enabled = e.NewValue == CheckState.Checked || e.NewValue == CheckState.Indeterminate;

                // break if the DisableOnSelected list doesn't exist,
                // or if we're not getting checked
                if (component.DisableOnSelected == null ||
                    e.NewValue != CheckState.Checked)
                {
                    break;
                }

                // disable required components
                foreach (string dComponent in component.DisableOnSelected)
                {
                    foreach (InstallerComponent c in InstallerComponents.Components)
                    {
                        // skip if not required
                        if (c.Name != dComponent)
                        {
                            continue;
                        }

                        // disable component
                        c.Enabled = false;

                        int dComponentIndex = InstallComponentsList.FindStringExact(dComponent);

                        // break when not found
                        if (dComponentIndex == -1)
                        {
                            break;
                        }

                        InstallComponentsList.SetItemCheckState(dComponentIndex, CheckState.Unchecked);
                    }
                }

                break;
            }

            InstallButton.Enabled = true;
        }
        private void InstallComponentsList_ShowToolTip(object source, MouseEventArgs args)
        {
            int newIndex = InstallComponentsList.IndexFromPoint(args.Location);

            if (ToolTipIndex == newIndex ||
                newIndex == -1)
            {
                return;
            }

            ToolTipIndex = newIndex;

            InstallerComponentToolTip.SetToolTip(InstallComponentsList, DescriptionList[ToolTipIndex]);
        }
Exemplo n.º 3
0
        public SelectInstallComponents()
        {
            InitializeComponent();

            foreach (InstallerComponent component in InstallerSettings.InstallerComponents.Components)
            {
                int componentIndex = InstallComponentsList.Items.Add(component.Name, component.Enabled);

                if (component.ReadOnly)
                {
                    InstallComponentsList.SetItemCheckState(componentIndex, CheckState.Indeterminate);
                }

                _descriptionList.Add(component.Description);
            }
        }
        public SelectInstallComponents(InstallerComponents installerComponents)
        {
            InitializeComponent();

            // we sadly need InstallerComponents really early
            // so we set it here
            this.InstallerComponents = installerComponents;

            foreach (InstallerComponent component in InstallerComponents.Components)
            {
                int componentIndex = InstallComponentsList.Items.Add(component.Name, component.Enabled);

                if (component.ReadOnly)
                {
                    InstallComponentsList.SetItemCheckState(componentIndex, CheckState.Indeterminate);
                }

                DescriptionList.Add(component.Description);
            }
        }