2016-05-30 3 views
0

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

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

CreateNotification方法は、私はNotificationsExtensions.Win10 Nugetパッケージを使用してバッジ数を実装することができbadgeContent.Howでは使用できません。

+0

以下のコードはこの例外を示しています:値が予想される範囲内にない。 – subminer

答えて

0

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

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

をあなたは新しいBadgeNumericNotificationContentインスタンスを作成した後、あなただけのコンテンツを得ました。このコンテンツからGetXml()に電話をかけ、XML文書をBadgeNotificationインスタンスに設定する必要があります。その後、BadgeNotificationでバッジを更新できます。

+0

私は大きなタイル、中型タイル、ワイドタイルにのみバッジを見せなければなりません。 – subminer

+0

@サブマナーそれは不可能だと思います。詳細を知りたい場合や、いくつかの回避策が必要な場合は、この新しい質問に関する新しいスレッドを開き、質問に関するその他のことを記述することができます。 –

1
var badge = new BadgeNumericNotificationContent(2); 
     XmlDocument bdoc = content.GetXml(); 
     BadgeNotification bnotification = new BadgeNotification(bdoc); 
     BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(bnotification); 
+0

私は大きなタイル、中型タイル、ワイドタイルにのみバッジを表示しなければなりません。 – subminer

+0

ライブタイルをアニメーション化する方法は? – subminer

関連する問題