AppNotificationBuilder.IsUrgentScenarioSupported 方法

定義

傳回值,指出目前裝置是否支援緊急代理程式更新案例。

public:
 static bool IsUrgentScenarioSupported();
 static bool IsUrgentScenarioSupported();
public static bool IsUrgentScenarioSupported();
function isUrgentScenarioSupported()
Public Shared Function IsUrgentScenarioSupported () As Boolean

傳回

Boolean

bool

如果目前的裝置支援緊急代理程式更新案例,則為 True;否則為 false。

範例

下列範例示範如何檢查是否支援緊急代理程式更新案例。

var builder = new AppNotificationBuilder()
    .AddText("Notification text.");

if (AppNotificationBuilder.IsUrgentScenarioSupported())
{
    builder.SetScenario(AppNotificationScenario.Urgent);
}

AppNotificationManager.Default.Show(builder.BuildNotification());

如果支援緊急案例,則產生的 XML 承載:

<toast scenario='urgent'>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
</toast>

備註

AppNotificationBuilder.SetScenario方法可讓您從AppNotificationScenario列舉中指定其中一個案例,這會導致系統調整某些通知行為,以呈現指定案例的一致體驗。 只有 Windows 10 組建 19041 和更新版本才支援緊急案例值。 這個方法可讓您在執行時間判斷目前裝置是否支援緊急案例。

如需使用 AppNotificationBuilder API 建立代理程式更新 UI 的指引,請參閱 代理程式更新內容

如需代理程式更新之 XML 架構的參考資訊,請參閱 代理程式更新內容架構

適用於