AppNotificationBuilder.AddArgument(String, String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將由索引鍵/值組組成的引數新增至代理程式更新的 XML 承載。
public:
virtual AppNotificationBuilder ^ AddArgument(Platform::String ^ key, Platform::String ^ value) = AddArgument;
AppNotificationBuilder AddArgument(winrt::hstring const& key, winrt::hstring const& value);
public AppNotificationBuilder AddArgument(string key, string value);
function addArgument(key, value)
Public Function AddArgument (key As String, value As String) As AppNotificationBuilder
參數
- key
-
String
Platform::String
winrt::hstring
包含引數索引鍵的字串。
- value
-
String
Platform::String
winrt::hstring
包含引數值的字串。
傳回
傳回 AppNotificationBuilder 實例,以便鏈結其他方法呼叫。
範例
下列範例顯示這個方法的使用方式,將引數新增至代理程式更新。
var notification = new AppNotificationBuilder()
.AddText("Send a message.")
.AddTextBox("textBox")
.BuildNotification();
AppNotificationManager.Default.Show(notification);
產生的 XML 承載:
<toast launch='key=value'>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
</toast>
備註
使用此方法新增的代理程式更新引數會在使用者按一下通知時傳遞至已啟用的應用程式。 您可以將多個引數新增至每個通知。 藉由存取 AppNotificationActivatedEventArgs.Arguments 屬性,擷取以此方法新增的引數。
如需使用 AppNotificationBuilder API 建立代理程式更新 UI 的指引,請參閱 代理程式更新內容。
如需代理程式更新之 XML 架構的參考資訊,請參閱 代理程式更新內容架構。