private Filter createNewFilter(XElement line, Filter parent)
 {
     if (parent == null)
         return new Category(
             line.Attribute("name").Value,
             line.Attribute("extentions") != null ? line.Attribute("extentions").Value : "",
             line.Attribute("type") != null ? line.Attribute("type").Value : ""
             );
     else
         return new Filter(line.Attribute("name").Value, parent);
 }
 public FilterViewModel(Filter filter)
 {
     this._filter = filter;
 }
 public Filter(string name, Filter parent)
 {
     this.Name = name;
     this.Parent = parent;
     this.Filters = null;
 }
 private List<Filter> loadFilters(IEnumerable<XElement> filters, Filter parent)
 {
     if (filters != null)
     {
         List<Filter> tempList = new List<Filter>();
         Filter tempFilter = null;
         foreach (XElement element in filters)
         {
             if (element.Attribute("name") != null)
             {
                 tempFilter = this.createNewFilter(element, parent);
                 if (element.Elements() != null)
                     tempFilter.Filters = this.loadFilters(element.Elements(), tempFilter);
                 tempList.Add(tempFilter);
             }
         }
         return tempList;
     }
     return new List<Filter>();
 }
 private Filter newFilter(XElement xmlNode, Filter parent)
 {
     Filter newFilter;
     string filterName = xmlNode.Attribute("name").Value;
     if (parent == null)
     {
         string extention = (xmlNode.Attribute("extentions") != null ? xmlNode.Attribute("extentions").Value : "");
         string type = (xmlNode.Attribute("type") != null ? xmlNode.Attribute("type").Value : "");
         // string path = Path.ChangeExtension(this._filePath, "") + "_" + filterName + ".xml";
         newFilter = new Category(filterName, extention, type);
     }
     else
     {
         newFilter=  new Filter(filterName, parent);
     }
     return newFilter;
 }