protected virtual async ValueTask DisposeAsyncCore() { if (!isDisposed && (previousActiveTab != null)) { await previousActiveTab.NotifyDeactivatedAsync(); previousActiveTab = null; } isDisposed = true; }
/// <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); } } } }
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; }
private bool IsActive(HxTab tab) { return(ActiveTabId == tab.Id); }
/// <summary> /// Handle click on tab title to activate tab. /// </summary> protected async Task HandleTabClick(HxTab tab) { await SetActiveTabIdAsync(tab.Id); }