@@ -30,28 +30,34 @@ public static AppBuilder BuildAvaloniaApp()
3030
3131public static class AppBuilderExtensions
3232{
33- private static ISystemShell Shell { get ; } = new SystemShell ( ) ;
33+ private static ISystemShell Shell { get ; set ; }
3434
3535 public static AppBuilder SetupDesktopNotifications ( this AppBuilder builder , out INotificationManager manager )
3636 {
37- if ( Environment . OSVersion . Platform == PlatformID . Win32NT )
38- {
39- var context = WindowsApplicationContext . FromCurrentProcess ( ) ;
40- manager = new WindowsNotificationManager ( context ) ;
41- }
42- else if ( Environment . OSVersion . Platform == PlatformID . Unix )
43- {
44- var context = FreeDesktopApplicationContext . FromCurrentProcess ( ) ;
45- manager = new FreeDesktopNotificationManager ( context ) ;
46- }
47- else
37+ if ( OperatingSystem . IsWindows ( ) ) Shell = new SystemShell ( ) ;
38+
39+ // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault
40+ switch ( Environment . OSVersion . Platform )
4841 {
49- // TODO: OSX once implemented/stable
50- manager = null ;
51- return builder ;
42+ case PlatformID . Win32NT :
43+ {
44+ var context = WindowsApplicationContext . FromCurrentProcess ( ) ;
45+ manager = new WindowsNotificationManager ( context ) ;
46+ break ;
47+ }
48+ case PlatformID . Unix :
49+ {
50+ var context = FreeDesktopApplicationContext . FromCurrentProcess ( ) ;
51+ manager = new FreeDesktopNotificationManager ( context ) ;
52+ break ;
53+ }
54+ default :
55+ // TODO: OSX once implemented/stable
56+ manager = null ;
57+ return builder ;
5258 }
5359
54- if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
60+ if ( ! OperatingSystem . IsMacCatalyst ( ) && ! OperatingSystem . IsMacOS ( ) )
5561 manager . Initialize ( ) . GetAwaiter ( ) . GetResult ( ) ;
5662
5763 var notificationManager = manager ;
0 commit comments