File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
9.0/Apps/DeveloperBalance Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ namespace DeveloperBalance;
44
55public partial class App : Application
66{
7- public static IServiceProvider ServiceProvider { get ; private set ; }
7+ public static IServiceProvider ? ServiceProvider { get ; private set ; }
88
99 public App ( )
1010 {
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ namespace DeveloperBalance;
88
99public class SemanticScreenReaderAsyncImplementation : IAsyncAnnouncement
1010{
11- static NSObject Token ;
12- private TaskCompletionSource < bool > announcementCompletionSource ;
11+ static NSObject ? Token ;
12+ private TaskCompletionSource < bool > ? announcementCompletionSource ;
1313
1414 public void AddNotification ( )
1515 {
@@ -33,7 +33,7 @@ public void RemoveNotification()
3333
3434 private void AnnouncementDidFinish ( NSNotification notification )
3535 {
36- announcementCompletionSource . TrySetResult ( true ) ;
36+ announcementCompletionSource ? . TrySetResult ( true ) ;
3737 }
3838
3939 public void Announce ( string text )
Original file line number Diff line number Diff line change @@ -5,13 +5,19 @@ namespace DeveloperBalance.Services;
55
66public static class AnnouncementHelper
77{
8+ #pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
89 public static async Task Announce ( string recipeName )
910 {
1011#if IOS
11- var _semanticScreenReader = App . ServiceProvider . GetService < IAsyncAnnouncement > ( ) ;
12- await _semanticScreenReader . AnnounceAsync ( recipeName ) ;
12+ var _semanticScreenReader = App . ServiceProvider ? . GetService < IAsyncAnnouncement > ( ) ;
13+ if ( _semanticScreenReader is not null )
14+ {
15+ await _semanticScreenReader . AnnounceAsync ( recipeName ) ;
16+ }
1317#else
1418 SemanticScreenReader . Announce ( recipeName ) ;
1519#endif
1620 }
21+ #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
22+
1723}
You can’t perform that action at this time.
0 commit comments