/// <summary> /// Standard method of the <see cref="IXmlSerializable"/> interface. /// </summary> /// <returns></returns> public void ReadXml(XmlReader reader) { reader.ReadStartElement(); while (reader.NodeType == System.Xml.XmlNodeType.Whitespace) { reader.Read(); } if (reader.NodeType != System.Xml.XmlNodeType.EndElement) { try { var path = reader.GetAttribute("Path"); CurrentPath = PathFactory.Create(path); } catch { CurrentPath = PathFactory.SysDefault; } } reader.ReadStartElement("CurrentPath"); while (reader.NodeType == System.Xml.XmlNodeType.Whitespace) { reader.Read(); } // Read current filter settings var deserializer = new XmlSerializer(typeof(FilterItemModel)); CurrentFilter = (FilterItemModel)deserializer.Deserialize(reader); }
/// <summary> /// Copy constructor /// </summary> /// <param name="item"></param> public FilterItemModel(FilterItemModel item) : this() { if (item == null) { return; } this._FilterDisplayName = item.FilterDisplayName; this._FilterText = item.FilterText; }
/// <summary> /// Add a filter item into the collection of filters. /// </summary> /// <param name="name"></param> /// <param name="pattern"></param> /// <param name="bSelectNewFilter"></param> public void AddFilter(string name, string pattern, bool bSelectNewFilter = false) { var newFilter = new FilterItemModel(name, pattern); this.mFilterCollection.Add(newFilter); if (bSelectNewFilter == true && this.mUserProfile != null) { this.mUserProfile.SetCurrentFilter(newFilter); } }
/// <summary> /// Resets the currently viewed path to the path indicated by the /// <paramref name="model"/>. /// </summary> /// <param name="model"></param> public void SetCurrentFilter(FilterItemModel model) { CurrentFilter = model; }