ToastNotificationManager 클래스

정의

알림 메시지를 발생시키는 데 사용하는 ToastNotifier 개체를 만듭니다. 또한 이 클래스는 시스템에서 제공하는 알림 템플릿의 XML 콘텐츠에 대한 액세스를 제공하므로 알림에 사용할 콘텐츠를 사용자 지정할 수 있습니다.

public ref class ToastNotificationManager abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class ToastNotificationManager final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ToastNotificationManager final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public static class ToastNotificationManager
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public static class ToastNotificationManager
Public Class ToastNotificationManager
상속
Object Platform::Object IInspectable ToastNotificationManager
특성

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에서 도입되었습니다.)

예제

다음 예제에서는 GetTemplateContentCreateToastNotifier 메서드 사용을 포함하여 텍스트 및 이미지가 포함된 알림 메시지를 만들고 보내는 방법을 보여 줍니다.

var notifications = Windows.UI.Notifications;

// Get the toast notification manager for the current app.
var notificationManager = notifications.ToastNotificationManager;

// The getTemplateContent method returns a Windows.Data.Xml.Dom.XmlDocument object
// that contains the toast notification XML content.
var template = notifications.toastTemplateType.toastImageAndText01;
var toastXml = notificationManager.getTemplateContent(notifications.ToastTemplateType[template]);

// You can use the methods from the XML document to specify the required elements for the toast.
var images = toastXml.getElementsByTagName("image");
images[0].setAttribute("src", "images/toastImageAndText.png");

var textNodes = toastXml.getElementsByTagName("text");
textNodes.forEach(function (value, index) {
    var textNumber = index + 1;
    var text = "";
    for (var j = 0; j < 10; j++) {
        text += "Text input " + /*@static_cast(String)*/textNumber + " ";
    }
    value.appendChild(toastXml.createTextNode(text));
});

// Create a toast notification from the XML, then create a ToastNotifier object
// to send the toast.
var toast = new notifications.ToastNotification(toastXml);

notificationManager.createToastNotifier().show(toast);

설명

데스크톱 앱에서 알림 메시지 보내기

일반적으로 데스크톱 앱에서 알림 메시지를 보내는 것은 UWP 앱에서 보내는 것과 동일합니다. 그러나 다음과 같은 차이점과 요구 사항을 알고 있어야 합니다.

  • 데스크톱 앱에서 알림을 표시하려면 시작 화면에 바로 가기가 있어야 합니다.
  • 바로 가기에는 AppUserModelID가 있어야 합니다.
  • 데스크톱 앱은 알림을 예약할 수 없습니다.

자세한 내용은 다음 항목을 참조하세요.

버전 기록

Windows 버전 SDK 버전 추가된 값
1607 14393 ConfigureNotificationMirroring
1607 14393 GetForUser
1703 15063 GetDefault

속성

History

ToastNotificationHistory 개체를 가져옵니다.

메서드

ConfigureNotificationMirroring(NotificationMirroring)

알림 미러링이 허용되는지 여부를 지정합니다. 알림 미러링을 사용하면 알림을 여러 디바이스에서 브로드캐스트할 수 있습니다.

CreateToastNotifier()

해당 앱에 알림 메시지를 발생시킬 수 있는 호출 애플리케이션에 바인딩된 ToastNotification의 새 instance 만들고 초기화합니다.

CreateToastNotifier(String)

지정된 앱(일반적으로 동일한 패키지의 다른 앱)에 바인딩된 ToastNotification의 새 instance 만들고 초기화합니다.

GetDefault()

현재 사용자의 알림 메시지 관리자를 가져옵니다.

GetForUser(User)

지정된 사용자의 알림 메시지 관리자를 가져옵니다.

GetTemplateContent(ToastTemplateType)

미리 정의된 알림 템플릿 중 하나의 XML 콘텐츠를 가져오므로 알림에 사용할 수 있도록 사용자 지정할 수 있습니다.

적용 대상

추가 정보