// ---------------------------- // ACCESSORS // ---------------------------- #region Accessors /// <summary> /// Returns the application section of this instance with the specified complete name. /// </summary> /// <returns>The application section of this instance with the specified complete name.</returns> public IAppSection GetSectionWithCompleteName(String completeName) { if (completeName.Contains("$")) { completeName = completeName.Substring(completeName.IndexOf('$') + 1); } else { completeName = string.Empty; } string[] names = completeName.Split(new char[] { '$' }); IAppSection moduleSection = null; foreach (string name in names) { if (!string.IsNullOrEmpty(name)) { if (moduleSection == null) { moduleSection = GetSectionWithName(name); } else { moduleSection = moduleSection.GetSubSectionWithName(name); } } } return(moduleSection); }
// ------------------------------------------ // CONSTRUCTORS // ------------------------------------------ #region Constructors /// <summary> /// Initializes a new instance of the AppModuleSection class. /// </summary> /// <param name="name">The name to consider.</param> /// <param name="module">The application module of the instance.</param> /// <param name="parent">The parent section of the instance.</param> public AppSection( string name, IAppModule module = null, IAppSection parent = null) : base(name, "section_") { Module = module; Parent = parent; }
// ---------------------------- // MUTATORS // ---------------------------- #region Mutators /// <summary> /// Adds the specified section. /// </summary> /// <param name="section">The section to add.</param> /// <returns>Returns the specified section.</returns> public IAppModule AddSection(IAppSection section) { if (section != null) { (Sections ?? (Sections = new TDataItemSet <AppSection>())).Add(section as AppSection); section.Module = this; } return(this); }
// ---------------------------- // MUTATORS // ---------------------------- #region Mutators /// <summary> /// Adds the specified section. /// </summary> /// <param name="section">The section to add.</param> /// <returns>Returns the specified section.</returns> public void AddSection(IAppSection section) { (SubSections ?? (SubSections = new TDataItemSet <AppSection>())).Add(section as AppSection); section.Parent = this; section.Module = Module; }