佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > Windows 8技巧:Windows 8 中的Toast Tile Badge通知的使用方法

Windows 8技巧:Windows 8 中的Toast Tile Badge通知的使用方法

熱門標(biāo)簽:硅谷的囚徒呼叫中心 萬科 鐵路電話系統(tǒng) 科大訊飛語音識別系統(tǒng) 電銷機(jī)器人源碼 電銷機(jī)器人 電話機(jī)器人搭建 呼叫中心案例

  在Windows 8中有三種通知的方式及時(shí)提醒用戶,它們分別是Toast,Tile,Badge

  Toast:是在應(yīng)用程序中及時(shí)彈出的提醒通知。

  Tile:是磁貼通知,用于Metro界面中的應(yīng)用程序圖標(biāo)上進(jìn)行圖片和文字通知。

  Badge:是在磁貼小貼士通知,用于Metro界面中的應(yīng)用程序圖標(biāo)右下角提示當(dāng)前有多少新消息或者當(dāng)前應(yīng)用程序狀態(tài),如(playing paused newMessage)等。

  準(zhǔn)備工作:   首先:引用NotificationsExtensions.winmd庫,這是對各種通知簡化訪問的封裝。

        其次:打開Package.appxmanifest重新設(shè)置各種徽標(biāo)。

        最后:打開Package.appxmanifest,設(shè)置“支持Toast通知”為“是”。

Toast:

復(fù)制代碼
代碼如下:

private void ToastNotice_Click(object sender, RoutedEventArgs e)
{
//Toast通知文字以及圖片設(shè)置
IToastImageAndText01 Toast = ToastContentFactory.CreateToastImageAndText01();
Toast.TextBodyWrap.Text = "今日世界末日倒數(shù)10天!";
Toast.Image.Src = "http://news.shangdu.com/301/20120512/P_5626361_0__1686841290.jpg";
ToastNotificationManager.CreateToastNotifier().Show(Toast.CreateNotification());
}

效果圖片:

Tile:

復(fù)制代碼
代碼如下:

private void TileNotice_Click(object sender, RoutedEventArgs e)
{
//Tile通知文字以及圖片設(shè)置
ITileWideImageAndText01 tile = TileContentFactory.CreateTileWideImageAndText01();
tile.TextCaptionWrap.Text = "小資情有獨(dú)鐘 10款合資熱銷時(shí)尚車型導(dǎo)購";
tile.Image.Src = "http://news.mycar168.com/uploadfile/2011/1030/20111030040816628.jpg";/p> p> ITileSquareImage wideImageContent = TileContentFactory.CreateTileSquareImage();
wideImageContent.Image.Src = "http://news.mycar168.com/uploadfile/2011/1030/20111030040816628.jpg";
tile.SquareContent = wideImageContent;
TileUpdateManager.CreateTileUpdaterForApplication().Update(tile.CreateNotification());
}/p> p> private void ClearTile_Click(object sender, RoutedEventArgs e)
{
//清除Tile通知
TileUpdateManager.CreateTileUpdaterForApplication().Clear();
}

效果圖片:

Badge:

復(fù)制代碼
代碼如下:

private void BadgeNotice_Click(object sender, RoutedEventArgs e)
{
//Badge數(shù)字通知
BadgeNumericNotificationContent badge = new BadgeNumericNotificationContent(29);
BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badge.CreateNotification());
}/p> p> private void BadgeImage_Click(object sender, RoutedEventArgs e)
{
//Badge狀態(tài)圖片通知
BadgeGlyphNotificationContent badge = new BadgeGlyphNotificationContent(GlyphValue.Paused);
BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badge.CreateNotification());
}/p> p> private void BadgeClear_Click(object sender, RoutedEventArgs e)
{
//清楚Badge通知
BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();
}

圖片效果見圖片右下角:

 

Xaml:

復(fù)制代碼
代碼如下:

Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
Button Content="Toast通知" HorizontalAlignment="Left" Name="ToastNotice"
Margin="250,172,0,0" VerticalAlignment="Top" Click="ToastNotice_Click"/>
Button Content="Tile 通知" HorizontalAlignment="Left" Name="TileNotice"
Margin="394,172,0,0" VerticalAlignment="Top" Click="TileNotice_Click"/>
Button Content="清除Tile通知" HorizontalAlignment="Left" Name="ClearTile"
Margin="559,172,0,0" VerticalAlignment="Top" Click="ClearTile_Click" />
Button Content="Badge數(shù)字" HorizontalAlignment="Left" Name="BadgeNotice"
Margin="250,270,0,0" VerticalAlignment="Top" Click="BadgeNotice_Click"/>
Button Content="Badge圖片" HorizontalAlignment="Left" Name="BadgeImage"
Margin="394,270,0,0" VerticalAlignment="Top" Click="BadgeImage_Click" />
Button Content="Badge清除" HorizontalAlignment="Left" x:Name="BadgeClear"
Margin="559,270,0,0" VerticalAlignment="Top" Click="BadgeClear_Click" />
/Grid>
  

  最后如需源碼請點(diǎn)擊 Win8Notice_jb51net.rar 下載。 

標(biāo)簽:新余 株洲 黃石 呼和浩特 天門 南通 六安 黔東

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Windows 8技巧:Windows 8 中的Toast Tile Badge通知的使用方法》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    耿马| 安阳市| 德化县| 鄯善县| 内乡县| 蕲春县| 江孜县| 内黄县| 高密市| 开平市| 普格县| 吴堡县| 南华县| 苏尼特右旗| 祁连县| 高邑县| 台江县| 车致| 当涂县| 尚志市| 阳东县| 鸡东县| 勃利县| 阿城市| 屏南县| 平塘县| 开阳县| 梨树县| 读书| 临夏县| 岳西县| 新龙县| 盈江县| 沛县| 资源县| 福泉市| 郯城县| 昭苏县| 义马市| 保靖县| 华宁县|