/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="p_strName">The name of the group.</param> /// <param name="p_gtpType">The options that are part of this group.</param> /// <param name="p_srtOptionOrder">the order by which to sort the options in this group.</param> public OptionGroup(string p_strName, OptionGroupType p_gtpType, SortOrder p_srtOptionOrder) { Name = p_strName; Type = p_gtpType; OptionSortOrder = p_srtOptionOrder; m_lstOptions.CollectionChanged += new NotifyCollectionChangedEventHandler(Options_CollectionChanged); }
/// <summary> /// Creates a option group based on the given info. /// </summary> /// <param name="p_xelGroup">The script file node corresponding to the group to add.</param> /// <returns>The added group.</returns> protected virtual OptionGroup ParseGroup(XElement p_xelGroup) { string strName = p_xelGroup.Attribute("name").Value; OptionGroupType gtpType = (OptionGroupType)Enum.Parse(typeof(OptionGroupType), p_xelGroup.Attribute("type").Value); XElement xelOptions = p_xelGroup.Element("plugins"); OptionGroup pgpGroup = new OptionGroup(strName, gtpType, SortOrder.Ascending); foreach (XElement xelOption in xelOptions.Elements()) { pgpGroup.Options.Add(ParseOption(xelOption)); } return(pgpGroup); }
/// <summary> /// Creates a option group based on the given info. /// </summary> /// <param name="p_xelGroup">The script file node corresponding to the group to add.</param> /// <returns>The added group.</returns> protected override OptionGroup ParseGroup(XElement p_xelGroup) { string strName = p_xelGroup.Attribute("name").Value; OptionGroupType gtpType = (OptionGroupType)Enum.Parse(typeof(OptionGroupType), p_xelGroup.Attribute("type").Value); XElement xelOptions = p_xelGroup.Element("plugins"); SortOrder sodOptionOrder = ParseSortOrder(xelOptions.Attribute("order").Value); OptionGroup pgpGroup = new OptionGroup(strName, gtpType, sodOptionOrder); foreach (XElement xelOption in xelOptions.Elements()) { pgpGroup.Options.Add(ParseOption(xelOption)); } return(pgpGroup); }
/// <summary> /// Translates the given <see cref="OptionGroupType"/> into the string representation /// used in the XML. /// </summary> /// <param name="p_gtpType">The <see cref="OptionGroupType"/> to unparse.</param> /// <returns>The string representation used in the XML for the given <see cref="OptionGroupType"/>.</returns> protected string UnparseOptionGroupType(OptionGroupType p_gtpType) { return p_gtpType.ToString(); }
/// <summary> /// Translates the given <see cref="OptionGroupType"/> into the string representation /// used in the XML. /// </summary> /// <param name="p_gtpType">The <see cref="OptionGroupType"/> to unparse.</param> /// <returns>The string representation used in the XML for the given <see cref="OptionGroupType"/>.</returns> protected string UnparseOptionGroupType(OptionGroupType p_gtpType) { return(p_gtpType.ToString()); }