Share via


NSMenu.Notifications.ObserveDidSendAction Method

Definition

Overloads

Name Description
ObserveDidSendAction(NSObject, EventHandler<NSMenuItemEventArgs>)

Strongly typed notification for the DidSendActionNotification constant.

ObserveDidSendAction(EventHandler<NSMenuItemEventArgs>)

Strongly typed notification for the DidSendActionNotification constant.

ObserveDidSendAction(NSObject, EventHandler<NSMenuItemEventArgs>)

Strongly typed notification for the DidSendActionNotification constant.

public static Foundation.NSObject ObserveDidSendAction(Foundation.NSObject objectToObserve, EventHandler<AppKit.NSMenuItemEventArgs> handler);
static member ObserveDidSendAction : Foundation.NSObject * EventHandler<AppKit.NSMenuItemEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSMenuItemEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to DidSendActionNotification notifications.

// Listen to all notifications posted for a single object
var token = NSMenu.Notifications.ObserveDidSendAction (objectToObserve, (notification) => {
  Console.WriteLine ($"Observed DidSendActionNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Applies to

ObserveDidSendAction(EventHandler<NSMenuItemEventArgs>)

Strongly typed notification for the DidSendActionNotification constant.

public static Foundation.NSObject ObserveDidSendAction(EventHandler<AppKit.NSMenuItemEventArgs> handler);
static member ObserveDidSendAction : EventHandler<AppKit.NSMenuItemEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSMenuItemEventArgs>

The handler that responds to the notification when it occurs.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>).

Remarks

This method can be used to subscribe to DidSendActionNotification notifications.

// Listen to all notifications posted for any object
var token = NSMenu.Notifications.ObserveDidSendAction ((notification) => {
  Console.WriteLine ("Observed DidSendActionNotification!");
};

// Stop listening for notifications
token.Dispose ();

Applies to