MLModelCollection.DidChangeNotification Proprietà
Definizione
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.
Attenzione
This property always returns null.
Questa proprietà restituisce nullsempre .
[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
Valore della proprietà
NSString costante, deve essere usata come token per NSNotificationCenter.
- Attributi
Commenti
Questa costante può essere usata con NSNotificationCenter per registrare un listener per questa notifica. Si tratta di una NSString stringa anziché di una stringa, perché questi valori possono essere usati come token in alcune librerie native anziché essere usati esclusivamente per il contenuto effettivo della stringa. Il parametro 'notification' per il callback contiene informazioni aggiuntive specifiche del tipo di notifica.
Per sottoscrivere questa notifica, gli sviluppatori possono usare i metodi o ObserveDidChange(EventHandler<NSNotificationEventArgs>) praticiObserveDidChange(NSObject, EventHandler<NSNotificationEventArgs>), che offrono accesso fortemente tipizzato ai parametri della notifica.
Nell'esempio seguente viene illustrato come usare la classe fortemente tipizzata MLModelCollection.Notifications per escludere le ipotesi dalle proprietà disponibili nella notifica:
//
// 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'esempio seguente illustra come usare la notifica con 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);
}