Share via


NSPopover.Notifications.ObserveDidClose Method

Definition

Overloads

Name Description
ObserveDidClose(EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the DidCloseNotification constant.

ObserveDidClose(NSObject, EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the DidCloseNotification constant.

ObserveDidClose(EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the DidCloseNotification constant.

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

Parameters

handler
EventHandler<NSPopoverCloseEventArgs>

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 DidCloseNotification notifications.

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

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

Applies to

ObserveDidClose(NSObject, EventHandler<NSPopoverCloseEventArgs>)

Strongly typed notification for the DidCloseNotification constant.

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

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSPopoverCloseEventArgs>

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 DidCloseNotification notifications.

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

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

Applies to