/// <summary> /// Activates the specified item. /// </summary> /// <param name="item">The item to activate.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>A task that represents the asynchronous operation.</returns> public override async Task ActivateItemAsync(T item, CancellationToken cancellationToken = default) { if (item != null && item.Equals(ActiveItem)) { if (IsActive) { await ScreenExtensions.TryActivateAsync(item, cancellationToken); OnActivationProcessed(item, true); } return; } await ChangeActiveItemAsync(item, false, cancellationToken); }
/// <summary> /// Activates the specified item. /// </summary> /// <param name="item">The item to activate.</param> /// <param name="cancellationToken">The cancellation token to cancel operation.</param> /// <returns>A task that represents the asynchronous operation.</returns> public override async Task ActivateItemAsync(T item, CancellationToken cancellationToken) { if (item == null) { return; } item = EnsureItem(item); if (IsActive) { await ScreenExtensions.TryActivateAsync(item, cancellationToken); } OnActivationProcessed(item, true); }
/// <inheritdoc /> public override async Task ActivateItemAsync(T item, CancellationToken cancellationToken = default) { if (item != null && item.Equals(ActiveItem)) { if (IsActive) { await ScreenExtensions.TryActivateAsync(item, cancellationToken); OnActivationProcessed(item, true); } return; } var closeResult = await CloseStrategy.ExecuteAsync(new[] { ActiveItem }, cancellationToken); if (closeResult.CloseCanOccur) { await ChangeActiveItemAsync(item, true, cancellationToken); } else { OnActivationProcessed(item, false); } }
/// <summary> /// Called when activating. /// </summary> /// <param name="cancellationToken">The cancellation token to cancel operation.</param> /// <returns>A task that represents the asynchronous operation.</returns> protected override Task OnActivateAsync(CancellationToken cancellationToken) { return(ScreenExtensions.TryActivateAsync(ActiveItem, cancellationToken)); }