@@ -32,8 +32,8 @@ internal static class WindowsAppNotificationBridge
3232
3333 private static readonly string [ ] _assemblyCandidates =
3434 {
35- "Microsoft.Windows.AppNotifications" ,
36- "Microsoft.WindowsAppSDK " ,
35+ "Microsoft.Windows.AppNotifications.Projection " ,
36+ "Microsoft.Windows.AppNotifications.Builder.Projection " ,
3737 } ;
3838
3939 public static bool ShowProgress ( AbstractOperation operation )
@@ -384,9 +384,6 @@ private static bool EnsureRegistered()
384384 return _isRegistered ;
385385 }
386386
387- managerType . GetMethod ( "Register" , BindingFlags . Public | BindingFlags . Instance )
388- ? . Invoke ( _managerDefault , null ) ;
389-
390387 _removeByTagAsyncMethod = managerType . GetMethod (
391388 "RemoveByTagAsync" ,
392389 BindingFlags . Public | BindingFlags . Instance ,
@@ -416,6 +413,14 @@ private static bool EnsureRegistered()
416413 notifEventInfo . AddEventHandler ( _managerDefault , lambda . Compile ( ) ) ;
417414 }
418415
416+ managerType . GetMethod (
417+ "Register" ,
418+ BindingFlags . Public | BindingFlags . Instance ,
419+ binder : null ,
420+ types : Type . EmptyTypes ,
421+ modifiers : null )
422+ ? . Invoke ( _managerDefault , null ) ;
423+
419424 _isRegistered = _showMethod is not null ;
420425 }
421426 catch ( Exception ex )
@@ -495,9 +500,19 @@ private static bool ShowTextToast(
495500
496501 private static object InvokeFluent ( object instance , string methodName , params object ? [ ] args )
497502 {
498- return instance . GetType ( ) . GetMethod ( methodName , BindingFlags . Public | BindingFlags . Instance )
499- ? . Invoke ( instance , args )
500- ?? instance ;
503+ Type type = instance . GetType ( ) ;
504+ Type [ ] argTypes = args . Select ( a => a ? . GetType ( ) ?? typeof ( object ) ) . ToArray ( ) ;
505+
506+ MethodInfo ? method = type . GetMethod (
507+ methodName ,
508+ BindingFlags . Public | BindingFlags . Instance ,
509+ binder : null ,
510+ types : argTypes ,
511+ modifiers : null )
512+ ?? type . GetMethods ( BindingFlags . Public | BindingFlags . Instance )
513+ . FirstOrDefault ( m => m . Name == methodName && m . GetParameters ( ) . Length == args . Length ) ;
514+
515+ return method ? . Invoke ( instance , args ) ?? instance ;
501516 }
502517
503518 private static void SetPropertyIfPresent ( object instance , string propertyName , object value )
0 commit comments