NSUndoManager.Notifications.ObserveWillRedoChange Metodo
In questo articolo
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
ObserveWillRedoChange(EventHandler<NSNotificationEventArgs>) |
Notifica fortemente tipizzata per la WillRedoChangeNotification costante. |
ObserveWillRedoChange(NSObject, EventHandler<NSNotificationEventArgs>) |
Notifica fortemente tipizzata per la WillRedoChangeNotification costante. |
Notifica fortemente tipizzata per la WillRedoChangeNotification costante.
public static Foundation.NSObject ObserveWillRedoChange(EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWillRedoChange : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parametri
- handler
- EventHandler<NSNotificationEventArgs>
Metodo da richiamare quando viene pubblicata la notifica.
Restituisce
Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)
Commenti
Nell'esempio seguente viene illustrato come usare questo metodo nel codice
//
// Lambda style
//
// listening
notification = NSUndoManager.Notifications.ObserveWillRedoChange ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
}
void Setup ()
{
notification = NSUndoManager.Notifications.ObserveWillRedoChange (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Si applica a
Notifica fortemente tipizzata per la WillRedoChangeNotification costante.
public static Foundation.NSObject ObserveWillRedoChange(Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveWillRedoChange : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject
Parametri
- objectToObserve
- NSObject
Oggetto da osservare.
- handler
- EventHandler<NSNotificationEventArgs>
Metodo da richiamare quando viene pubblicata la notifica.
Restituisce
Oggetto token che può essere usato per arrestare la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)
Commenti
Questo metodo può essere usato per sottoscrivere WillRedoChangeNotification le notifiche.
// Listen to all notifications posted for any object
var token = NSUndoManager.Notifications.ObserveWillRedoChange ((notification) => {
Console.WriteLine ("Observed WillRedoChangeNotification!");
};
// Listen to all notifications posted for a single object
var token = NSUndoManager.Notifications.ObserveWillRedoChange (objectToObserve, (notification) => {
Console.WriteLine ($"Observed WillRedoChangeNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();