示例#1
0
        public void Populate(Type userClass)
        {
            string providerName = CookiesManager.GetUserCookieProviderName(userClass);

            _cookieProvidersBox.SuspendLayout();
            _cookieProvidersBox.Items.Clear();
            CookieProviderItem item;
            int index;

            foreach (ICookieProvider provider in CookiesManager.GetAllProviders())
            {
                item  = new CookieProviderItem(provider);
                index = _cookieProvidersBox.Items.Add(item);
                if (item.ToString() == providerName)
                {
                    _cookieProvidersBox.SelectedIndex = index;
                }
            }
            item  = new CookieProviderItem(null);
            index = _cookieProvidersBox.Items.Add(item);
            if (item.ToString() == providerName)
            {
                _cookieProvidersBox.SelectedIndex = index;
            }
            _cookieProvidersBox.ResumeLayout();
        }