Exemplo n.º 1
0
        /// <summary>
        /// Validate the configuration and save it
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            XmlNode      root, node, ignore;
            XmlAttribute attr;

            // Store the changes
            root = config.SelectSingleNode("configuration");

            attr = root.Attributes["useGAC"];

            if (attr == null)
            {
                attr = config.CreateAttribute("useGAC");
                root.Attributes.Append(attr);
            }

            attr.Value = chkUseGAC.Checked.ToString().ToLowerInvariant();

            items.Clear();

            foreach (BindingRedirectSettings brs in lbRedirects.Items)
            {
                items.Add(brs);
            }

            items.ToXml(config, root, true);

            node = root.SelectSingleNode("ignoreIfUnresolved");

            if (node == null)
            {
                node = config.CreateNode(XmlNodeType.Element, "ignoreIfUnresolved", null);
                root.AppendChild(node);
            }
            else
            {
                node.RemoveAll();
            }

            foreach (string item in lbIgnoreIfUnresolved.Items)
            {
                ignore = config.CreateNode(XmlNodeType.Element, "assemblyIdentity", null);
                root.AppendChild(node);

                attr       = config.CreateAttribute("name");
                attr.Value = item;
                ignore.Attributes.Append(attr);

                node.AppendChild(ignore);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Validate the configuration and save it
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            XmlNode root;

            // Store the changes
            root = config.SelectSingleNode("configuration");

            items.Clear();

            foreach (BindingRedirectSettings brs in lbRedirects.Items)
            {
                items.Add(brs);
            }

            items.ToXml(config, root);

            this.DialogResult = DialogResult.OK;
            this.Close();
        }