【问题标题】:How can I update my app's Live Tile Badge in WP8?如何在 WP8 中更新我的应用程序 Live Tile Badge?
【发布时间】:2013-01-19 16:13:14
【问题描述】:

我希望 Nathan 的“带有 XAML 和 C# 的 Windows 8 应用程序”第 549 页的代码:

    //string xmlString = @"<badge value='2'/>";
    string xmlString = string.Format(@"<badge value={0}/>", 42);
    XmlDocument document = new XmlDocument(); 
    document.LoadXml(xmlString); 
    BadgeNotification notification = new BadgeNotification(document);
    BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(notification);

...也适用于 WP8,但许多类在我的 WP8 ScheduledTaskAgent 中无法识别,即 XmlDocument、BadgeNotification 和 BadgeUpdateManager。

如何通过我的 ScheduledTaskAgent 在 WP8 中完成同样的事情?

【问题讨论】:

    标签: c# xml windows-phone-8 windows-store-apps badge


    【解决方案1】:

    WP8 上用于更新徽章的 API 与 Windows 8 上的不同。可以使用 StandardTileData 对象上的 Count 属性设置徽章值。

    MSDN 上的WP8 Tile sample 显示了更详细的代码。

    【讨论】:

      【解决方案2】:
      XmlDocument badgeDOM = new XmlDocument();
      badgeDOM.LoadXml(string.Format("<badge value='{0}'/>", 42));
      BadgeNotification badge = new BadgeNotification(badgeDOM);
      BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badge);
      

      【讨论】:

      • "" - 有撇号 ('),在第一篇文章中没有
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-20
      相关资源
      最近更新 更多