-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
SemanticScreenReader.shared.cs
44 lines (38 loc) · 1.32 KB
/
SemanticScreenReader.shared.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#nullable enable
namespace Microsoft.Maui.Accessibility
{
/// <summary>
/// The SemanticScreenReader API enables an application announce audible text to the user.
/// </summary>
public interface ISemanticScreenReader
{
/// <summary>
/// Announces the specified text through the operating system's screen reader.
/// </summary>
/// <param name="text">The text to announce.</param>
void Announce(string text);
}
/// <summary>
/// The SemanticScreenReader API enables an application announce audible text to the user.
/// </summary>
public static partial class SemanticScreenReader
{
/// <summary>
/// Announces the specified text through the operating system's screen reader.
/// </summary>
/// <param name="text">The text to announce.</param>
public static void Announce(string text)
{
Current.Announce(text);
}
static ISemanticScreenReader Current => Accessibility.SemanticScreenReader.Default;
static ISemanticScreenReader? defaultImplementation;
/// <summary>
/// Provides the default implementation for static usage of this API.
/// </summary>
public static ISemanticScreenReader Default =>
defaultImplementation ??= new SemanticScreenReaderImplementation();
internal static void SetDefault(ISemanticScreenReader? implementation) =>
defaultImplementation = implementation;
}
}