NSUndoManager.Notifications.ObserveDidCloseUndoGroup Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ObserveDidCloseUndoGroup(EventHandler<NSUndoManagerCloseUndoGroupEventArgs>) |
Strongly typed notification for the DidCloseUndoGroupNotification constant. |
ObserveDidCloseUndoGroup(NSObject, EventHandler<NSUndoManagerCloseUndoGroupEventArgs>) |
Strongly typed notification for the DidCloseUndoGroupNotification constant. |
ObserveDidCloseUndoGroup(EventHandler<NSUndoManagerCloseUndoGroupEventArgs>)
Strongly typed notification for the DidCloseUndoGroupNotification constant.
public static Foundation.NSObject ObserveDidCloseUndoGroup (EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> handler);
static member ObserveDidCloseUndoGroup : EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> -> Foundation.NSObject
Parameters
Method to invoke when the notification is posted.
Returns
Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)
Remarks
The following example shows how developers can use this method in their code:
//
// Lambda style
//
// listening
notification = NSUndoManager.Notifications.ObserveDidCloseUndoGroup ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("Discardable", args.Discardable);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSUndoManagerCloseUndoGroupEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("Discardable", args.Discardable);
}
void Setup ()
{
notification = NSUndoManager.Notifications.ObserveDidCloseUndoGroup (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Applies to
ObserveDidCloseUndoGroup(NSObject, EventHandler<NSUndoManagerCloseUndoGroupEventArgs>)
Strongly typed notification for the DidCloseUndoGroupNotification constant.
public static Foundation.NSObject ObserveDidCloseUndoGroup (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> handler);
static member ObserveDidCloseUndoGroup : Foundation.NSObject * EventHandler<Foundation.NSUndoManagerCloseUndoGroupEventArgs> -> Foundation.NSObject
Parameters
- objectToObserve
- NSObject
The object to observe.
Method to invoke when the notification is posted.
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 for DidCloseUndoGroupNotification notifications.
// Listen to all notifications posted for any object
var token = NSUndoManager.Notifications.ObserveDidCloseUndoGroup ((notification) => {
Console.WriteLine ("Observed DidCloseUndoGroupNotification!");
};
// Listen to all notifications posted for a single object
var token = NSUndoManager.Notifications.ObserveDidCloseUndoGroup (objectToObserve, (notification) => {
Console.WriteLine ($"Observed DidCloseUndoGroupNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();