Share via


NSUndoManager.Notifications.ObserveWillCloseUndoGroup Method

Definition

Overloads

ObserveWillCloseUndoGroup(EventHandler<NSUndoManagerCloseUndoGroupEventArgs>)

Strongly typed notification for the WillCloseUndoGroupNotification constant.

public static Foundation.NSObject ObserveWillCloseUndoGroup(EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> handler);
static member ObserveWillCloseUndoGroup : EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSUndoManagerCloseUndoGroupEventArgs>

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

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

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

Applies to

ObserveWillCloseUndoGroup(NSObject, EventHandler<NSUndoManagerCloseUndoGroupEventArgs>)

Strongly typed notification for the WillCloseUndoGroupNotification constant.

public static Foundation.NSObject ObserveWillCloseUndoGroup(Foundation.NSObject objectToObserve, EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> handler);
static member ObserveWillCloseUndoGroup : Foundation.NSObject * EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<NSUndoManagerCloseUndoGroupEventArgs>

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

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

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

Applies to