首页 > 其他分享 >uwp 之吐司 toast

uwp 之吐司 toast

时间:2023-06-05 22:05:22浏览次数:34  
标签:toast xml Windows 吐司 uwp ToastNotificationManager content Notifications UI

Toast
--------------------------------------------------------------
var t = Windows.UI.Notifications.ToastTemplateType.ToastText02;
            //在模板添加xml要的标题
            var content = Windows.UI.Notifications.ToastNotificationManager.GetTemplateContent(t);
            //需要using Windows.Data.Xml.Dom;
            XmlNodeList xml = content.GetElementsByTagName("text");
            xml[0].AppendChild(content.CreateTextNode("通知"));
            xml[1].AppendChild(content.CreateTextNode("小文本"));
            //需要using Windows.UI.Notifications;
            Windows.UI.Notifications.ToastNotification toast = new ToastNotification(content);
            ToastNotificationManager.CreateToastNotifier().Show(toast);

标签:toast,xml,Windows,吐司,uwp,ToastNotificationManager,content,Notifications,UI
From: https://blog.51cto.com/u_4018548/6419762

相关文章

  • uwp 之资源的访问
     访问image资源-----------------------------------------------------------------------------BitmapImagebitmapImage=newBitmapImage();img.Width=bitmapImage.DecodePixelWidth=80;//naturalpxwidthofimagesource......
  • uwp Button的动态效果
    你应该覆盖Button样式<Page.Resources><StyleTargetType="Button"x:Key="CustomButtonStyle"><SetterProperty="Background"Value="{ThemeResourceSystemControlBackgroundBaseLowBrush}"/>......
  • uiautomator2获取toast提示
    可以使用uiautomator2的toast方法来获取app中弹出的toast提示。具体操作如下:1.导入uiautomator2库:fromuiautomator2import*2.连接设备:d=u2.connect('设备序列号')3.打开app:d.app_start('应用包名')4.等待toast弹出:toast_msg=d.toast.get_m......
  • UWP的 LocalSettings简介
    UWP程序的AppData一般位于C:\Users\<UserName>\AppData\Local\Packages\<PackageFamilyName>目录下,该目录包含如下内容常用的两个目录为:LocalState和Settings,其中LocalState主要用来存储本地的文件如Log等内容。Settings目录下的settings.dat则对应于ApplicationDataContainer,......
  • Android Studio学习日志二,Toast用法
    首先,创建一个util,在ToastUtil里面调用方法在里面编写Toast类的代码,方便以后调用packagecom.example.appdemo.util;importandroid.content.Context;importandroid.widget.Toast;publicclassToastUtil{publicstaticToastmToast;publicstaticvoidsh......
  • PostgresQL-toast表数据损坏修复案例
    PostgresQL-toast表数据损坏修复案例pg_statistic-toast表块损坏修复当访问该表的时候报错:missingchunknumber0fortoastvalue59747165inpg_toast_2619首先我们要找到出问题的表:toast表的表名是字符串"pg_toast"与表tbl的oid"2619"拼接而成,可以直接查询oid=26191、......
  • C# Winfom实现Toast功能
    publicclassToast{publicclassToastInfo{publicFormOwner{get;set;}publicstringText{get;set;}="";publicboolIncrease{get;set;}=true;publicintSt......
  • Win11卸载“连接手机”UWP应用
    孽缘起因Win11提示可以联机手机,在电脑上能读取到手机上的通知,短信,通话等,也是闲着无事,就安装了试了试,发现其实没有MIUI+好用,就另外装上之后电脑玩游戏时CPU占用规律性的100%,我怀疑有bug,就准备卸载。结果呢?呵!好家伙,这鬼东西不让卸载!流氓行径!微软你学啥不好学这玩意,你这......卸......
  • 解决uniapp不显示showToast或一闪而过问题
    原因:showToast与其他方法冲突,以onLoad冲突为例第一种:将showToast与showLoading分开,放到mounted中mounted(){//判断是否登录 if(!this.hasLogin){ uni.showToast({ title:'登录过期', icon:'none' }) }},onLoad(option){ ......
  • 如何在WPF中调用Windows 10/11 API(UWP/WinRT)
    最近在github上看到一个音乐播放器项目,dopamine(项目地址:https://github.com/digimezzo/dopamine-windows.git)在编译时,提示有一个库找不到  找了好一会,才发现这是调用了UWP的库。在最初Windows8出来时,这一套新的运行时叫WindowsRT,后面到Windows10时,改成了UWP。因为......