Windows8商店应用的 通知 分为三种类型:

     Badge(锁屏提醒):通知锁屏提醒可传达有关应用或应用特定的摘要或状态信息。这些信息可以是数字 (1-99) 或 Windows 所提供的一组字形中的一个。

MSDN:http://msdn.microsoft.com/zh-cn/library/windows/apps/hh779719.aspx

示例代码:

int number)
   2:     {
// Note: This sample contains an additional project, NotificationsExtensions.
// NotificationsExtensions exposes an object model for creating notifications, but you can also modify the xml
// of the notification directly. See the additional function UpdateBadgeWithNumberWithStringManipulation to see how to do it
// by modifying strings directly
   7:  
uint)number);
   9:  
// send the notification to the app's application tile
  11:         BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification());
  12:  
  13:      
  14:     }

     Toast 通知:Toast 通知是在屏幕右上角(对于从右到左 (RTL) 方向的语言,则位于左上角)显示的通知,它让应用可以告知用户他/她是在另一个应用中、在“开始”屏幕上,还是在桌面上。

MSDN:http://msdn.microsoft.com/zh-cn/library/windows/apps/hh779727.aspx 
示例代码:

string toastXmlString = String.Empty;
if (templateType == ToastTemplateType.ToastText01)
   3:            {
;
  11:            }
if (templateType == ToastTemplateType.ToastText02)
  13:            {
;
  22:            }
if (templateType == ToastTemplateType.ToastText03)
  24:            {
;
  33:            }
if (templateType == ToastTemplateType.ToastText04)
  35:            {
;
  45:            }
  46:  
new Windows.Data.Xml.Dom.XmlDocument();
  48:            toastDOM.LoadXml(toastXmlString);

     Tile(辅助磁贴):辅助磁贴使用户能够将 Windows 应用商店应用的特定内容和深层链接—对固定应用内部一个特定位置的引用—发送到“开始”屏幕上。辅助磁贴使用户能够使用好友、新闻源、股票报价和其他对其很重要的内容来个性化“开始”屏幕体验。

MSDN:http://msdn.microsoft.com/zh-cn/library/windows/apps/hh465372.aspx

示例代码:

// create a string with the tile template xml
;
  13:  
// create a DOM
new Windows.Data.Xml.Dom.XmlDocument();
// load the xml string into the DOM, catching any invalid xml characters 
  17:            tileDOM.LoadXml(tileXmlString);
  18:  
// create a tile notification
new TileNotification(tileDOM);
  21:  
// send the notification to the app's application tile
  23:            TileUpdateManager.CreateTileUpdaterForApplication().Update(tile);

这里比较值得一提的是微软封装好的类库:NotificationsExtensions.rar  下面的2个示例都用到了它,大家可以好好研究下,学习微软是怎么封装类库的

Apptilesandbadgessample.rar

Toastnotificationssample.rar

相关文章:

  • 2021-11-05
  • 2022-01-14
  • 2021-11-03
  • 2021-11-04
  • 2021-08-27
  • 2021-12-18
  • 2021-10-03
  • 2022-12-23
猜你喜欢
  • 2021-06-27
  • 2021-12-08
  • 2021-09-18
  • 2022-02-11
  • 2022-12-23
  • 2021-12-27
相关资源
相似解决方案