日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

在Metro App中显示Toast notification

發(fā)布時間:2024/4/18 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在Metro App中显示Toast notification 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?

?Toast notification是向用戶顯示一些有關(guān)App的即時消息。具體Toast notification是什么可以參考
?
http://msdn.microsoft.com/en-us/library/windows/apps/hh465360(v=VS.85).aspx
?創(chuàng)建Toast notification步驟:
?1.在Package.appxmanifest文件中設(shè)置ToastCapable="true",否則Toast Notification不能顯示。
? <VisualElements? ForegroundText="light" BackgroundColor="#000000" ToastCapable="true">
? ForegroundText標(biāo)簽表示Toast notification消息文字的樣式(有dark和light兩種),BackgroundColor
? 標(biāo)簽表示Toast notification的背景顏色。

?2.下面是顯示Toast notification的代碼:
??private void ShowToast()
??{
????? // GetTemplateContent returns a Windows.Data.Xml.Dom.XmlDocument object containing
????? // the toast XML

????? XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText04);
????? XmlElement xe = toastXml.CreateElement("title");

????? // You can use the methods from the XML document to specify all of the
????? // required parameters for the toast
????? XmlNodeList stringElements = toastXml.GetElementsByTagName("text");

????? for (uint i = 0; i < stringElements.Length; i++)
????? {
???stringElements.Item(i).AppendChild(toastXml.CreateTextNode("Pressed Screenshot key !"));
????? }

????? // Create a toast from the Xml, then create a ToastNotifier object to show
????? // the toast
????? ToastNotification toast = new ToastNotification(toastXml);

????? // If you have other applications in your package, you can specify the AppId of
????? // the app to create a ToastNotifier for that application

????? ToastNotificationManager.CreateToastNotifier().Show(toast);

??}

?完成上面兩步后,調(diào)用ShowToast方法就會在右下角顯示一個Toast notification。

總結(jié)

以上是生活随笔為你收集整理的在Metro App中显示Toast notification的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。