Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FluentSplashScreen] Add WaitingMilliseconds and UpdateLabels #1570

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

dvoituron
Copy link
Collaborator

@dvoituron dvoituron commented Feb 26, 2024

[FluentSplashScreen] Add WaitingMilliseconds and UpdateLabels

Adding two new properties to allow SplashScreen customization during the loading process:

  • SplashScreenContent.DisplayTime: Gets or sets the delay to wait before to close the dialog. Default is 4000 milliseconds.
  • SplashScreenContent.UpdateLabels(loadingText, message): Updates the labels of the splash screen.

Example

DialogParameters<SplashScreenContent> parameters = new()
{
    Content = new()
    {
        DisplayTime = 0,    // // <============== See Task.Delay below
        Title = "Core components",
        SubTitle = "Microsoft Fluent UI Blazor library",
        LoadingText = "Loading...",
        Message = (MarkupString)"some <i>extra</i> text <strong>here</strong>",
    }
};
_dialog = await DialogService.ShowSplashScreenAsync(parameters);

var splashScreen = (SplashScreenContent)_dialog.Instance.Content;

// Simulate a first task
await Task.Delay(2000);

// Update the splash screen content and simulate a second task
splashScreen.UpdateLabels(loadingText: "Second task...");   // <==============
await Task.Delay(2000);

await _dialog.CloseAsync();

To solve #1566

@vnbaaij vnbaaij enabled auto-merge (squash) February 26, 2024 10:06
@vnbaaij vnbaaij merged commit 1d9085b into dev Feb 26, 2024
4 checks passed
@vnbaaij vnbaaij deleted the users/dvoituron/fix-splashscreen branch February 26, 2024 10:07
vnbaaij pushed a commit that referenced this pull request Mar 6, 2024
* Add WaitingMilliseconds and UpdateLabels

* Rename property to DisplayTime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants