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

                previousActiveTab = null;
            }

            isDisposed = true;
        }
예제 #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);
                    }
                }
            }
        }
예제 #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;
        }
예제 #4
0
 private bool IsActive(HxTab tab)
 {
     return(ActiveTabId == tab.Id);
 }
예제 #5
0
 /// <summary>
 /// Handle click on tab title to activate tab.
 /// </summary>
 protected async Task HandleTabClick(HxTab tab)
 {
     await SetActiveTabIdAsync(tab.Id);
 }