Skip to content

Commit 9747f16

Browse files
[SplashScreen] Mark sync methods as Obsolete (#4644)
* Mark methods as Obsolete * Remove sync demos * Mark methods as obsolete * Update docs * Code review fixes
1 parent d1b80b4 commit 9747f16

8 files changed

Lines changed: 34 additions & 57 deletions

examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3936,6 +3936,7 @@
39363936
left (full height), right (full height)
39373937
or screen middle (using Width and Height properties).
39383938
HorizontalAlignment.Stretch is not supported for this property.
3939+
NOTE: Left/Right only works for Panels, not Dialogs, which are always centered.
39393940
</summary>
39403941
</member>
39413942
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.Title">
@@ -8532,6 +8533,12 @@
85328533
<param name="force">If true, the total item count will be updated even if it is the same as the current value.</param>
85338534
<returns></returns>
85348535
</member>
8536+
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.LibraryConfiguration">
8537+
<summary />
8538+
</member>
8539+
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.JSRuntime">
8540+
<summary />
8541+
</member>
85358542
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.AnchorId">
85368543
<summary>
85378544
Gets or sets the id of the component the popover is positioned relative to.
@@ -8610,19 +8617,26 @@
86108617
By default, Escape
86118618
</summary>
86128619
</member>
8613-
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.CloseAndTabKeys">
8614-
<summary />
8615-
</member>
86168620
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.OnInitialized">
86178621
<summary />
86188622
</member>
86198623
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.OnParametersSet">
86208624
<summary />
86218625
</member>
8622-
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.CloseAsync">
8626+
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.OnAfterRenderAsync(System.Boolean)">
86238627
<summary />
86248628
</member>
8625-
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.CloseOnKeyAsync(Microsoft.FluentUI.AspNetCore.Components.FluentKeyCodeEventArgs)">
8629+
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.CloseAsync">
8630+
<summary>
8631+
Closes the popover. Called from JavaScript keyboard navigation.
8632+
</summary>
8633+
</member>
8634+
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.CloseOverlayAsync">
8635+
<summary>
8636+
Closes the popover and returns focus to the original element (used by the overlay on outside-click).
8637+
</summary>
8638+
</member>
8639+
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentPopover.DisposeAsync">
86268640
<summary />
86278641
</member>
86288642
<member name="T:Microsoft.FluentUI.AspNetCore.Components.FluentPresenceBadge">
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
@inject IDialogService DialogService
22

3-
<FluentButton @onclick="@OpenSplashCustom" Appearance="Appearance.Accent">
3+
<FluentButton @onclick="@OpenSplashCustomAsync" Appearance="Appearance.Accent">
44
Open splash screen
55
</FluentButton>
6-
7-
<FluentButton @onclick="@OpenSplashCustomAsync" Appearance="Appearance.Accent">
8-
Open splash screen (async)
9-
</FluentButton>

examples/Demo/Shared/Pages/SplashScreen/Examples/DialogSplashScreenCustom.razor.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,6 @@ private async Task OpenSplashCustomAsync()
3838
DialogResult result = await _dialog.Result;
3939
await HandleCustomSplashAsync(result);
4040
}
41-
private void OpenSplashCustom()
42-
{
43-
DemoLogger.WriteLine($"Open custom splashscreen for 4 seconds");
44-
DialogParameters<SplashScreenContent> parameters = new()
45-
{
46-
Content = new()
47-
{
48-
Title = "Water drinking 101",
49-
LoadingText = "Filling the re-useable bottles...",
50-
Message = (MarkupString)"Don't drink <strong>too</strong> much water!",
51-
Logo = "_content/FluentUI.Demo.Shared/images/Splash_Corporation_logo.png",
52-
},
53-
Width = "500px",
54-
Height = "300px",
55-
};
56-
DialogService.ShowSplashScreen<CustomSplashScreen>(this, HandleCustomSplashAsync, parameters);
57-
}
58-
5941
private async Task HandleCustomSplashAsync(DialogResult result)
6042
{
6143
await Task.Run(() => DemoLogger.WriteLine($"Custom splash closed"));
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
@inject IDialogService DialogService
22

3-
<FluentButton @onclick="@OpenSplashDefault" Appearance="Appearance.Accent">
4-
Open splash screen
5-
</FluentButton>
6-
73
<FluentButton @onclick="@OpenSplashDefaultAsync" Appearance="Appearance.Accent">
8-
Open splash screen (async)
4+
Open splash screen
95
</FluentButton>

examples/Demo/Shared/Pages/SplashScreen/Examples/DialogSplashScreenDefault.razor.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,6 @@ private async Task OpenSplashDefaultAsync()
4747
await HandleDefaultSplashAsync(result);
4848
}
4949

50-
private void OpenSplashDefault()
51-
{
52-
DemoLogger.WriteLine($"Open default SplashScreen for 4 seconds");
53-
DialogParameters<SplashScreenContent> parameters = new()
54-
{
55-
Content = new()
56-
{
57-
Title = "Core components",
58-
SubTitle = "Microsoft Fluent UI Blazor library",
59-
LoadingText = "Loading...",
60-
Message = (MarkupString)"some <i>extra</i> text <strong>here</strong>",
61-
Logo = FluentSplashScreen.LOGO,
62-
},
63-
Width = "640px",
64-
Height = "480px",
65-
Modal = true,
66-
};
67-
DialogService.ShowSplashScreen(this, HandleDefaultSplashAsync, parameters);
68-
}
69-
7050
private async Task HandleDefaultSplashAsync(DialogResult result)
7151
{
7252
await Task.Run(() => DemoLogger.WriteLine($"Default splash closed"));

examples/Demo/Shared/Pages/SplashScreen/SplashScreenPage.razor

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@
1515
To show a splash screen, the <code>DialogService</code> is used. The <code>DialogService</code> is a singleton service that can be injected
1616
into any page/component. It exposes the following methods to show a splash screen dialog:
1717
<ul>
18-
<li><code>ShowSplashScreen</code> / <code>ShowSplashScreenAsync</code> (uses the <code>FluentSplashScreen</code> to show the dialog)</li>
18+
<li><code>ShowSplashScreenAsync</code> (uses the <code>FluentSplashScreen</code> to show the dialog)</li>
1919
<li>
20-
<code>ShowSplashScreen&lt;T&gt;</code> / <code>ShowSplashScreenAsync&lt;T&gt;</code> where T is a custom component which inherits the <code>FluentSplashScreen</code> component
20+
<code>ShowSplashScreenAsync&lt;T&gt;</code> where T is a custom component which inherits the <code>FluentSplashScreen</code> component
2121
and implements <code>IDialogContentComponent&lt;SplashScreenContent&gt;</code> .</li>
2222
</ul>
2323
</p>
2424
<p>
25-
Internally, the <code>ShowSplashScreen</code> methods call the <code>ShowDialog</code> methods. If is possible to directly call these methods and thereby have
26-
access to all of the parameters. The <code>ShowSplashScreen</code> variants are just convenience methods that make ite easier to work with panels.
25+
Internally, the <code>ShowSplashScreenAsync</code> methods call the <code>ShowDialogAsync</code> methods. If is possible to directly call these methods and thereby have
26+
access to all of the parameters. The <code>ShowSplashScreenAsync</code> variants are just convenience methods that make ite easier to work with panels.
2727
</p>
2828

29+
<FluentMessageBar Title="Warning" Intent="@MessageIntent.Warning">
30+
The <code>DialogService</code>'s synchronous methods are obsoleted and will be removed in the next major version (v5).
31+
</FluentMessageBar>
2932

3033
<h2 id="example">Examples</h2>
3134

src/Core/Components/Dialog/Services/DialogService-SplashScreen.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public partial class DialogService
1414
/// <param name="receiver">The component that receives the callback</param>
1515
/// <param name="callback">Name of the callback function</param>
1616
/// <param name="parameters"><see cref="SplashScreenContent"/> that holds the content to display</param>
17+
[Obsolete("Use ShowSplashScreenAsync(object, Func, DialogParameters) instead.")]
1718
public void ShowSplashScreen(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
1819
=> ShowSplashScreen<FluentSplashScreen>(receiver, callback, parameters);
1920

@@ -23,6 +24,7 @@ public void ShowSplashScreen(object receiver, Func<DialogResult, Task> callback,
2324
/// <param name="receiver">The component that receives the callback</param>
2425
/// <param name="callback">Name of the callback function</param>
2526
/// <param name="parameters"><see cref="SplashScreenContent"/> that holds the content to display</param>
27+
[Obsolete("Use ShowSplashScreenAsync<T>(object, Func, DialogParameters) instead.")]
2628
public void ShowSplashScreen<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
2729
where T : IDialogContentComponent<SplashScreenContent>
2830
=> ShowSplashScreen(typeof(T), receiver, callback, parameters);
@@ -34,6 +36,7 @@ public void ShowSplashScreen<T>(object receiver, Func<DialogResult, Task> callba
3436
/// <param name="receiver">The component that receives the callback</param>
3537
/// <param name="callback">Name of the callback function</param>
3638
/// <param name="parameters"><see cref="SplashScreenContent"/> that holds the content to display</param>
39+
[Obsolete("Use ShowSplashScreenAsync(Type, object, Func, DialogParameters) instead.")]
3740
public void ShowSplashScreen(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
3841
{
3942
DialogParameters dialogParameters = new()

src/Core/Components/Dialog/Services/IDialogService-SplashScreen.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ namespace Microsoft.FluentUI.AspNetCore.Components;
66

77
public partial interface IDialogService
88
{
9+
[Obsolete("Use ShowSplashScreenAsync(object, Func, DialogParameters) instead.")]
910
void ShowSplashScreen(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters);
1011

12+
[Obsolete("Use ShowSplashScreenAsync<T>(object, Func, DialogParameters) instead.")]
1113
void ShowSplashScreen<T>(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters)
1214
where T : IDialogContentComponent<SplashScreenContent>;
1315

16+
[Obsolete("Use ShowSplashScreenAsync(Type, object, Func, DialogParameters) instead.")]
1417
void ShowSplashScreen(Type component, object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters);
1518

1619
Task<IDialogReference> ShowSplashScreenAsync(object receiver, Func<DialogResult, Task> callback, DialogParameters<SplashScreenContent> parameters);

0 commit comments

Comments
 (0)