Esempio n. 1
0
        protected virtual async ValueTask DisposeAsyncCore()
        {
            if (!isDisposed && (previousActiveTab != null))
            {
                await previousActiveTab.NotifyDeactivatedAsync();

                previousActiveTab = null;
            }

            isDisposed = true;
        }
Esempio n. 2
0
        /// <inheritdoc />
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (firstRender)
            {
                // when no tab is active after initial render, activate the first visible & enabled tab
                if (!tabsList.Any(tab => IsActive(tab)) && (tabsList.Count > 0))
                {
                    HxTab tabToActivate = tabsList.FirstOrDefault(tab => CascadeEnabledComponent.EnabledEffective(tab) && tab.Visible);
                    if (tabToActivate != null)
                    {
                        await SetActiveTabIdAsync(tabToActivate.Id);
                    }
                }
            }
        }
Esempio n. 3
0
        private async Task NotifyActivationAndDeativatationAsync()
        {
            HxTab activeTab = tabsList.FirstOrDefault(tab => IsActive(tab));

            if (activeTab == previousActiveTab)
            {
                return;
            }

            if (previousActiveTab != null)
            {
                await previousActiveTab.NotifyDeactivatedAsync();
            }

            if (activeTab != null)
            {
                await activeTab.NotifyActivatedAsync();
            }

            previousActiveTab = activeTab;
        }
Esempio n. 4
0
 private bool IsActive(HxTab tab)
 {
     return(ActiveTabId == tab.Id);
 }
Esempio n. 5
0
 /// <summary>
 /// Handle click on tab title to activate tab.
 /// </summary>
 protected async Task HandleTabClick(HxTab tab)
 {
     await SetActiveTabIdAsync(tab.Id);
 }