Exemple #1
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Asynchronously processes the component and renders output. </summary>
        /// <returns> An asynchronous result. </returns>
        /// <seealso cref="M:CoreXT.Toolkit.TagComponents.TagComponent.ProcessAsync()"/>
        public async override Task ProcessAsync()
        {
            var context = await ProcessContent() ? (IHtmlContent)TagOutput : await TagOutput.GetChildContentAsync();

            TagContext.Items.TryGetValue(typeof(Menu), out var menu);
            TagContext.Items.TryGetValue(typeof(MenuDropdown), out var menuDropdown);

            if (menu != null)
            {
                ((Menu)menu).Items.Add(context.Render());
                TagOutput.SuppressOutput(); // (this will be processed by the parent modal tag component)
            }
            else if (menuDropdown != null)
            {
                ((MenuDropdown)menuDropdown).Items.Add(context.Render());
                TagOutput.SuppressOutput(); // (this will be processed by the parent modal tag component)
            }
            else
            {
                TagOutput.Content.SetHtmlContent(context);
            }
        }