NotifyEventHandler Délégué

Définition

Représente la méthode qui gérera l’événement ScriptNotify .

public delegate void NotifyEventHandler(Platform::Object ^ sender, NotifyEventArgs ^ e);
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(3271414264, 28933, 19060, 161, 9, 222, 41, 223, 245, 107, 152)]
class NotifyEventHandler : MulticastDelegate
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(3271414264, 28933, 19060, 161, 9, 222, 41, 223, 245, 107, 152)]
public delegate void NotifyEventHandler(object sender, NotifyEventArgs e);
Public Delegate Sub NotifyEventHandler(sender As Object, e As NotifyEventArgs)

Paramètres

sender
Object

Platform::Object

IInspectable

Objet dans lequel le gestionnaire est attaché.

e
NotifyEventArgs

Données d'événement de l'événement.

Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10 (introduit dans 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v1.0)

Exemples

L’exemple de code suivant illustre l’utilisation de l’événement ScriptNotify dans les applications compilées pour Windows 8. À compter de Windows 8.1, omettez les lignes liées à AllowedScriptNotifyUris. Pour plus d’informations, consultez vue d’ensemble de la classe WebView .

public MyPage()
{
    this.InitializeComponent();
    MyWebView.ScriptNotify += MyWebView_ScriptNotify;

    // Here we have to set the AllowedScriptNotifyUri property because we are 
    // navigating to some site where we don't own the content and we want to 
    // allow window.external.notify() to pass data back to the app.
    List<Uri> allowedUris = new List<Uri>();
    allowedUris.Add(new Uri("http://www.bing.com"));
    MyWebView.AllowedScriptNotifyUris = allowedUris;
}

void MyWebView_ScriptNotify(object sender, NotifyEventArgs e)
{
    // Respond to the script notification.
}

S’applique à