Partager via


NSUndoManager.DidOpenUndoGroupNotification Propriété

Définition

Constante de notification pour DidOpenUndoGroup

[Foundation.Advice("Use NSUndoManager.Notifications.ObserveDidOpenUndoGroup helper method instead.")]
[Foundation.Field("NSUndoManagerDidOpenUndoGroupNotification", "Foundation")]
public static Foundation.NSString DidOpenUndoGroupNotification { get; }
member this.DidOpenUndoGroupNotification : Foundation.NSString

Valeur de propriété

La constante NSString doit être utilisée comme jeton pour NSNotificationCenter.

Attributs

Remarques

Cette constante peut être utilisée avec pour NSNotificationCenter inscrire un écouteur pour cette notification. Il s’agit d’un NSString au lieu d’une chaîne, car ces valeurs peuvent être utilisées comme jetons dans certaines bibliothèques natives au lieu d’être utilisées uniquement pour leur contenu de chaîne réel. Le paramètre « notification » du rappel contient des informations supplémentaires spécifiques au type de notification.

Si vous souhaitez vous abonner à cette notification, vous pouvez utiliser la méthode pratique NSUndoManager.Notifications.ObserveDidOpenUndoGroup qui offre un accès fortement typé aux paramètres de la notification.

L’exemple suivant montre comment utiliser la classe Notifications fortement typée pour extraire les suppositions des propriétés disponibles dans la notification :

//
// Lambda style
//

// listening
notification = NSUndoManager.Notifications.ObserveDidOpenUndoGroup ((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.ObserveDidOpenUndoGroup (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

L’exemple suivant montre comment utiliser la notification avec l’API DefaultCenter :

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        NSUndoManager.DidOpenUndoGroupNotification, (notification) => {Console.WriteLine ("Received the notification NSUndoManager", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification NSUndoManager", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (NSUndoManager.DidOpenUndoGroupNotification, Callback);
}

S’applique à