예제 #1
0
        public void SetGlobalFilterXml(XElement element)
        {
            CoverageFilter filter = this.Filter;

            try
            {
                this.Filter = CoverageFilter.FromXml(element.Element("filter").Elements().First());
                Dictionary <string, XElement> itemElements = new Dictionary <string, XElement>();
                foreach (XElement itemElement in element.Element("children").Elements("item"))
                {
                    itemElements[itemElement.Attribute("name").Value] = itemElement;
                }
                foreach (CoverageItem item in this.items)
                {
                    if (itemElements.ContainsKey(item.Name))
                    {
                        item.SetGlobalFilterXml(itemElements[item.Name]);
                    }
                    else
                    {
                        item.Filter = null;
                    }
                }
            }
            catch (Exception)
            {
                this.Filter = filter;
                throw;
            }
        }
예제 #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            string oldFilter = item.GetFilterXmlDocument().ToString();

            try
            {
                item.Filter       = CoverageFilter.FromXml(XDocument.Load(new StringReader(textBoxFilter.Text)));
                this.DialogResult = DialogResult.OK;
                Close();
            }
            catch (Exception ex)
            {
                item.Filter = CoverageFilter.FromXml(XDocument.Load(new StringReader(oldFilter)));
                MessageBox.Show(ex.Message);
            }
        }
예제 #3
0
 public void SetFilterXmlDocument(XDocument document)
 {
     this.Filter = CoverageFilter.FromXml(document);
 }