/// <summary>
        /// Creates a new EditHeaderDialog.
        /// </summary>
        public EditHeaderDialog()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            _propertyTable = new PropertyTable();
        }
        /// <summary>
        /// Displays the cookies.
        /// </summary>
        public void DisplayCookies()
        {
            PropertyTable bag = new PropertyTable();
            string category = "Cookies";

            foreach ( Cookie cookie in this.Cookies )
            {
                PropertySpec nameItem = new PropertySpec(cookie.Name,typeof(CookieWrapper),category,"Cookie");
                nameItem.ConverterTypeName = "Ecyware.GreenBlue.Controls.CookieWrapper";

                PropertySpec[] items = {nameItem};
                bag.Properties.AddRange(items);

                // add values
                bag[cookie.Name] = new CookieWrapper(cookie);
            }

            this.cookieProperties.SelectedObject = bag;
        }
        /// <summary>
        /// Adds the cookie collection to the property grid.
        /// </summary>
        /// <param name="cookies"> The cookies.</param>
        public void SetCookies(CookieCollection cookies)
        {
            // Set current cookies
            Cookies = cookies;

            PropertyTable bag = new PropertyTable();
            // bag.GetValue += new PropertySpecEventHandler(bag_GetValue);
            // bag.SetValue += new PropertySpecEventHandler(bag_SetValue);
            string category = "Cookies";

            foreach ( Cookie cookie in cookies )
            {
                PropertySpec nameItem = new PropertySpec(cookie.Name,typeof(CookieWrapper),category,"Cookie");
                nameItem.ConverterTypeName = "Ecyware.GreenBlue.Controls.CookieWrapper";

                PropertySpec[] items = {nameItem};
                bag.Properties.AddRange(items);

            //				// add values
                bag[cookie.Name] = new CookieWrapper(cookie);
            }

            this.cookieProperties.SelectedObject = bag;
        }
        /// <summary>
        /// Loads the http properties.
        /// </summary>
        /// <param name="httpProperties"> The HttpProperties type.</param>
        public void LoadHttpProperties(HttpProperties httpProperties)
        {
            this.RequestHeaders = httpProperties;

            PropertyTable bag = new PropertyTable();
            string category = "Request Headers";
            // string category2 = "Authentication";

            //PropertySpec item = new PropertySpec("Headers",typeof(HttpPropertiesWrapper),category,"Request Headers");
            PropertySpec accept = new PropertySpec("Accept", typeof(string),category);
            PropertySpec contentLength = new PropertySpec("Content Length",typeof(string), category);
            PropertySpec contentType = new PropertySpec("Content Type",typeof(string), category);
            PropertySpec ifModifiedSince = new PropertySpec("If Modified Since",typeof(DateTime), category);
            PropertySpec keepAlive = new PropertySpec("Keep Alive",typeof(bool), category);
            PropertySpec mediaType = new PropertySpec("Media Type",typeof(string), category);
            PropertySpec pipeline = new PropertySpec("Pipeline",typeof(bool), category);
            PropertySpec referer = new PropertySpec("Referer",typeof(string), category);
            PropertySpec sendChunked = new PropertySpec("Send Chunked",typeof(bool), category);
            PropertySpec transferEncoding = new PropertySpec("Transfer Encoding",typeof(string), category);
            PropertySpec userAgent = new PropertySpec("User Agent",typeof(string), category);
            PropertySpec timeout = new PropertySpec("Timeout",typeof(int), category);

            // PropertySpec addonHeaders = new PropertySpec("Additional headers",typeof(string[]), category);
            // PropertySpec ntlmAuth = new PropertySpec("Windows Integrated Security", typeof(bool), category2);
            // accept.ConverterTypeName = "Ecyware.GreenBlue.Controls.HttpPropertiesWrapper";

            bag.Properties.AddRange(new PropertySpec[] {accept,
                                                           contentLength,
                                                           contentType,
                                                           ifModifiedSince,
                                                           keepAlive,
                                                           mediaType,
                                                           pipeline,
                                                           referer,
                                                           sendChunked,
                                                           transferEncoding,
                                                           userAgent, timeout});

            bag[accept.Name] = httpProperties.Accept;
            bag[contentLength.Name] = httpProperties.ContentLength;
            bag[contentType.Name] = httpProperties.ContentType;
            bag[ifModifiedSince.Name] = httpProperties.IfModifiedSince;
            bag[keepAlive.Name] = httpProperties.KeepAlive;
            bag[mediaType.Name] = httpProperties.MediaType;
            bag[pipeline.Name] = httpProperties.Pipeline;
            bag[referer.Name] = httpProperties.Referer;
            bag[sendChunked.Name] = httpProperties.SendChunked;
            bag[transferEncoding.Name] = httpProperties.TransferEncoding;
            bag[userAgent.Name] = httpProperties.UserAgent;
            bag[timeout.Name] = httpProperties.Timeout;
            //bag[addonHeaders.Name] = new string[0];
            // bag[ntlmAuth.Name] = httpProperties.AuthenticationSettings.UseNTLMAuthentication;

            this.pgHeaders.SelectedObject = bag;
        }
        /// <summary>
        /// Adds the cookie collection to the property grid.
        /// </summary>
        /// <param name="cookies"> The cookies.</param>
        private void SetCookies(Ecyware.GreenBlue.Engine.Scripting.Cookie[] cookies)
        {
            PropertyTable bag = new PropertyTable();
            bag.Properties.Clear();
            // bag.GetValue += new PropertySpecEventHandler(bag_GetValue);
            // bag.SetValue += new PropertySpecEventHandler(bag_SetValue);
            string category = "Cookies";

            foreach ( Ecyware.GreenBlue.Engine.Scripting.Cookie cookie in cookies )
            {
                PropertySpec nameItem = new PropertySpec(cookie.Name,typeof(CookieWrapper),category,"Cookie");
                nameItem.ConverterTypeName = "Ecyware.GreenBlue.Controls.CookieWrapperExtended";

                PropertySpec[] items = {nameItem};
                bag.Properties.AddRange(items);

                // add values
                bag[cookie.Name] = new CookieWrapperExtended(cookie);
            }

            this.pgCookies.SelectedObject = bag;
        }