/// <summary>
        /// Setup the initial privileges
        /// </summary>
        /// <param name="role"></param>
        private void initPriv(privRole role)
        {
            switch (role)
            {
            case privRole.user:

                CheckedListBox.ObjectCollection uitem = clbUserPriv.Items;
                int uindex = 0;
                foreach (KeyValuePair <string, bool> entry in config.InitData.UserPriv)
                {
                    uitem.Insert(uindex, entry.Key);
                    clbUserPriv.SetItemChecked(uindex, entry.Value);
                    uindex++;
                }
                break;

            case privRole.admin:
                CheckedListBox.ObjectCollection aitem = clbAdminPriv.Items;
                int aindex = 0;
                foreach (KeyValuePair <string, bool> entry in config.InitData.AdminPriv)
                {
                    aitem.Insert(aindex, entry.Key);
                    clbAdminPriv.SetItemChecked(aindex, entry.Value);
                    aindex++;
                }
                break;
            }
        }
Exemple #2
0
        public static void InsertRange(this CheckedListBox.ObjectCollection collection, int index, object[] array)
        {
            var i = 0;

            while (i < array.Length)
            {
                collection.Insert(index++, array[i++]);
            }
        }