NotifyEventHandler Delegat

Definition

Stellt die -Methode dar, die das ScriptNotify-Ereignis behandelt.

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)

Parameter

sender
Object

Platform::Object

IInspectable

Das Objekt, in dem der Handler angefügt ist.

e
NotifyEventArgs

Die Ereignisdaten für das Ereignis.

Attribute

Windows-Anforderungen

Gerätefamilie
Windows 10 (eingeführt in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v1.0)

Beispiele

Im folgenden Codebeispiel wird die Verwendung des ScriptNotify-Ereignisses in Apps veranschaulicht, die für Windows 8 kompiliert wurden. Lassen Sie ab Windows 8.1 die Zeilen im Zusammenhang mit AllowedScriptNotifyUris aus. Weitere Informationen finden Sie in der Übersicht über die WebView-Klasse .

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.
}

Gilt für: