ScheduledToastNotification クラス

定義

スケジュールされた時刻に表示されるトースト通知を定義する XML が含まれます。

public ref class ScheduledToastNotification sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class ScheduledToastNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class ScheduledToastNotification final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(Windows.UI.Notifications.IScheduledToastNotificationFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ScheduledToastNotification final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class ScheduledToastNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ScheduledToastNotification
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.UI.Notifications.IScheduledToastNotificationFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ScheduledToastNotification
function ScheduledToastNotification(content, deliveryTime, snoozeInterval, maximumSnoozeCount)
Public NotInheritable Class ScheduledToastNotification
継承
Object Platform::Object IInspectable ScheduledToastNotification
属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

次の例は、1 時間で表示するようにスケジュールされたトースト通知を示しています。

var Notifications = Windows.UI.Notifications;
var currentTime = new Date();
var seconds = 60;
var dueTime = new Date(currentTime.getTime() + seconds * 60 * 1000);
var idNumber = Math.floor(Math.random() * 100000000);  // Generates a unique ID number for the notification.

// Set up the notification text.
var toastXml = Notifications.ToastNotificationManager.getTemplateContent(Notifications.ToastTemplateType.toastText02);
var strings = toastXml.getElementsByTagName("text");
strings[0].appendChild(toastXml.createTextNode(This is a scheduled toast notification));
strings[1].appendChild(toastXml.createTextNode("Received: " + dueTime.toLocaleTimeString()));

// Create the toast notification object.
var toast = new Notifications.ScheduledToastNotification(toastXml, dueTime);
toast.id = "Toast" + idNumber;

// Add to the schedule.
Notifications.ToastNotificationManager.createToastNotifier().addToSchedule(toast);

注釈

ScheduledToastNotification を呼び出して、このオブジェクトの新しいインスタンスを作成して初期化します。

バージョン履歴

Windows のバージョン SDK バージョン 追加された値
1607 14393 NotificationMirroring
1607 14393 RemoteId
1803 17134 ExpirationTime

コンストラクター

ScheduledToastNotification(XmlDocument, DateTime)

ScheduledToastNotification の新しいインスタンスを作成して初期化します。このインスタンスは 1 回だけ表示されます。

ScheduledToastNotification(XmlDocument, DateTime, TimeSpan, UInt32)

Windows 10では非推奨です。 Windows 8 システムでは、ScheduledToastNotification の新しいインスタンスを作成して初期化します。このインスタンスは、最初に表示された後、指定した時刻の後に再び表示されます。 Windows 10では、この関数は ScheduledToastNotification(XmlDocument, DateTime) と同等に機能します。 Windows 10で同じ再通知間隔の動作を実現するには、トーストでボタンを使用できます。

プロパティ

Content

このスケジュールされたトースト通知を定義する XML を取得します。

DeliveryTime

このトースト通知が表示されるようにスケジュールされている時刻を取得します。

ExpirationTime

通知の有効期限を取得または設定します。

Group

通知のグループ識別子を取得または設定します。

Id

特定のスケジュールされたトーストを識別するために使用される開発者指定の値を取得します。

MaximumSnoozeCount

この通知を表示する最大回数を取得します。

NotificationMirroring

通知ミラーリングが有効かどうかを示す値を取得または設定します。 (通知ミラーリングを使用すると、通知を複数のデバイスに表示できます)。

RemoteId

システムがこの通知を別のデバイスで生成された別の通知と関連付けることができる通知のリモート ID を取得または設定します。

SnoozeInterval

通知が発生するまでの時間を取得します。

SuppressPopup

トーストのポップアップ UI をユーザーの画面に表示するかどうかを取得または設定します。

Tag

グループ内のトースト通知を一意に識別する文字列を取得または設定 します

適用対象

こちらもご覧ください