Ejemplo n.º 1
0
        void blk_cmbSpecific_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox box = (ComboBox)sender;

            if (blockSupressEvents)
            {
                return;
            }
            int idx = box.SelectedIndex;

            if (idx == -1)
            {
                return;
            }
            BlockGetOrAddPermsChanged();

            List <LevelPermission> perms = blockPerms.Allowed;

            ComboBox[] boxes  = blockAllowBoxes;
            int        boxIdx = Array.IndexOf <ComboBox>(boxes, box);

            if (boxIdx == -1)
            {
                perms  = blockPerms.Disallowed;
                boxes  = blockDisallowBoxes;
                boxIdx = Array.IndexOf <ComboBox>(boxes, box);
            }

            if (idx == box.Items.Count - 1)
            {
                if (boxIdx >= perms.Count)
                {
                    return;
                }
                perms.RemoveAt(boxIdx);

                blockSupressEvents = true;
                GuiPerms.SetSpecificPerms(perms, boxes);
                blockSupressEvents = false;
            }
            else
            {
                GuiPerms.SetSpecific(boxes, boxIdx, perms, idx);
            }
        }