Example #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;
            }
        }
        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);
            }
        }
Example #3
0
 public void Hide()
 {
     if (this.Parent != null)
     {
         CoverageFilterFunction function = new CoverageFilterFunction()
         {
             Function  = CoverageFilterFunctions.NotEqual,
             Parameter = this.Name
         };
         if (this.Parent.Filter == null)
         {
             this.Parent.Filter = function;
         }
         else
         {
             this.Parent.Filter = new CoverageFilterAnd()
             {
                 Left  = function,
                 Right = this.Parent.Filter
             };
         }
     }
 }
Example #4
0
 public void SetFilterXmlDocument(XDocument document)
 {
     this.Filter = CoverageFilter.FromXml(document);
 }