0

Windows 10 アプリケーションを作成しています。ライブ タイルにバッジを表示する必要があります。NotificationsExtensions.Win10 Nuget パッケージをインストールしました。次のコードを使用します。

  public static void UpdateTileBadgeNumberUsingNotificationExtensions()
    {
        BadgeNumericNotificationContent badgeContent = new BadgeNumericNotificationContent(2);
        BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification());
    }

ここで CreateNotification メソッドは BadgeContent では使用できません。NotificationsExtensions.Win10 Nuget パッケージを使用してバッジ カウントを実装するにはどうすればよいですか。

4

2 に答える 2

0

次のようにコードを更新してください。

 BadgeNumericNotificationContent badgeContent = new BadgeNumericNotificationContent(2);
 BadgeNotification bnotification = new BadgeNotification(badgeContent.GetXml());
 BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(bnotification);

新しいBadgeNumericNotificationContentインスタンスを作成したら、コンテンツを取得しただけです。GetXml()このコンテンツから呼び出して、xml ドキュメントをBadgeNotificationインスタンスに設定する必要があります。その後、 でバッジを更新できますBadgeNotification

于 2016-05-31T10:13:23.413 に答える