Example #1
0
        void BtnRemoveClick(object sender, EventArgs e)
        {
            if (localRegistryListBox.SelectedItem == null)
            {
                return;
            }
            var item = (ILocalRegistry)localRegistryListBox.SelectedItem;

            if (item.IsFromAutoDetect)
            {
                if (MessageBox.Show(I._("bpmgui_msg_disableautodet"), I._("bpmgui_msg_warn"),
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2
                                    ) == DialogResult.Yes)
                {
                    localRegistryListBox.Items.Remove(item);
                    RegistryManager.Config.LocalRegisteries.Remove(item);
                    RegistryManager.Config.LocalRegisteryInhibitions.Add(item);
                    localRegistryListBox.SelectedIndex = -1;
                    localRegistryListBox.ForceMeasure();
                    AssertListSync();
                }
            }
            else
            {
                if (MessageBox.Show(I._("bpmgui_msg_removereg"), I._("bpmgui_msg_warn"),
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2
                                    ) == DialogResult.Yes)
                {
                    localRegistryListBox.Items.Remove(item);
                    RegistryManager.Config.LocalRegisteries.Remove(item);
                    localRegistryListBox.SelectedIndex = -1;
                    RegistryManager.AutoDetect();
                    foreach (var r in RegistryManager.Config.LocalRegisteries)
                    {
                        if (!localRegistryListBox.Items.Contains(r))
                        {
                            localRegistryListBox.Items.Add(r);
                        }
                    }
                    AssertListSync();
                }
            }
        }