MLModelCollection.DidChangeNotification Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Attention
This property always returns null.
Cette propriété retourne nulltoujours .
[Foundation.Advice("Use MLModelCollection.Notifications.ObserveDidChange helper method instead.")]
[Foundation.Field("MLModelCollectionDidChangeNotification", "CoreML")]
public static Foundation.NSString DidChangeNotification { get; }
[System.Obsolete("This property always returns null.")]
public static Foundation.NSString? DidChangeNotification { get; }
[<Foundation.Advice("Use MLModelCollection.Notifications.ObserveDidChange helper method instead.")>]
[<Foundation.Field("MLModelCollectionDidChangeNotification", "CoreML")>]
static member DidChangeNotification : Foundation.NSString
[<System.Obsolete("This property always returns null.")>]
static member DidChangeNotification : Foundation.NSString
Valeur de propriété
NSString constante, doit être utilisée comme jeton à NSNotificationCenter.
- Attributs
Remarques
Cette constante peut être utilisée pour NSNotificationCenter inscrire un écouteur pour cette notification. Il s’agit d’une NSString chaîne plutôt que 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.
Pour vous abonner à cette notification, les développeurs peuvent utiliser la commodité ObserveDidChange(NSObject, EventHandler<NSNotificationEventArgs>) ou ObserveDidChange(EventHandler<NSNotificationEventArgs>) les méthodes, qui offrent un accès fortement typé aux paramètres de la notification.
L’exemple suivant montre comment utiliser la classe fortement typée MLModelCollection.Notifications pour extraire les estimations des propriétés disponibles dans la notification :
//
// Lambda style
//
// listening
notification = MLModelCollection.Notifications.ObserveDidChange ((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, MLModelCollection.NSNotificationEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
}
void Setup ()
{
notification = MLModelCollection.Notifications.ObserveDidChange (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
L’exemple suivant montre comment utiliser la notification avec l’API DefaultCenter :
// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
MLModelCollection.DidChangeNotification, (notification) => { Console.WriteLine ("Received the notification DidChange", notification); }
);
// Method style
void Callback (NSNotification notification)
{
Console.WriteLine ("Received the notification DidChange", notification);
}
void Setup ()
{
NSNotificationCenter.DefaultCenter.AddObserver (MLModelCollection.DidChangeNotification, Callback);
}