Beispiel #1
0
        /// <summary>
        /// Reloads the state of the control.
        /// </summary>
        public void SetMemento(Properties memento)
        {
            ignoreXPathTextChanges = true;

            try {
                // Set namespaces.
                string[] namespaces = memento.Get(NamespacesProperty, new string[0]);
                foreach (string ns in namespaces)
                {
                    XmlNamespace xmlNamespace = XmlNamespace.FromString(ns);
                    AddNamespace(xmlNamespace.Prefix, xmlNamespace.Uri);
                }

                // Set namespace data grid column widths.
                prefixColumn.Width = memento.Get <int>(PrefixColumnWidthProperty, 50);

                // Set xpath results list view column widths.
                matchColumnHeader.Width = memento.Get <int>(MatchColumnWidthProperty, 432);
                lineColumnHeader.Width  = memento.Get <int>(LineColumnWidthProperty, 60);

                // Set xpath query history.
                XPathComboBox.Text = memento.Get(XPathComboBoxTextProperty, String.Empty);
                string[] xpaths = memento.Get(XPathComboBoxItemsProperty, new string[0]);
                foreach (string xpath in xpaths)
                {
                    xPathComboBox.Items.Add(xpath);
                }
            } finally {
                ignoreXPathTextChanges = false;
            }
        }
 void LoadNamespaces(Properties properties)
 {
     string[] namespaces = properties.Get(NamespacesProperty, new string[0]);
     foreach (string ns in namespaces)
     {
         XmlNamespace xmlNamespace = XmlNamespace.FromString(ns);
         AddNamespace(xmlNamespace.Prefix, xmlNamespace.Name);
     }
 }
        void LoadNamespaces(Properties properties)
        {
            var namespaces = properties.GetList <string>(NamespacesProperty);

            foreach (string ns in namespaces)
            {
                XmlNamespace xmlNamespace = XmlNamespace.FromString(ns);
                AddNamespace(xmlNamespace.Prefix, xmlNamespace.Name);
            }
        }