zoukankan      html  css  js  c++  java
  • Windows Phone 十三、吐司通知

    弹出通知对话框

    1     <Grid>
    2         <Button 
    3             Content="弹出通知"
    4             Click="Button_Click"/>
    5     </Grid>
    1         private async void Button_Click(object sender, RoutedEventArgs e)
    2         {
    3             ////创建对话框对象
    4             //MessageDialog dialog = new MessageDialog("吐司通知");
    5             ////展示对话框
    6             //await dialog.ShowAsync();
    7             //少用,就像网页中不要使用alert一样
    8             await new MessageDialog("弹出对话框").ShowAsync();
    9         }

    吐司通知

    1     <Grid>
    2         <Button 
    3             Content="吐司通知"
    4             Click="Button_Click_1"/>
    5     </Grid>
     1         private async void Button_Click_1(object sender, RoutedEventArgs e)
     2         {
     3             //获取基本吐司模版
     4             var toastTmpl = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
     5             //填充模版占位符
     6             var textNode = toastTmpl.GetElementsByTagName("text").FirstOrDefault();
     7             if (textNode == null)
     8             {
     9                 await new Windows.UI.Popups.MessageDialog("shit").ShowAsync();
    10                 return;
    11             }
    12             //设置innerText
    13             textNode.InnerText = "Hello";
    14             //创建一个吐司通知对象
    15             var toastNotification = new ToastNotification(toastTmpl);
    16             //展示吐司通知
    17             //展示吐司通知需要一个展示对象
    18             ToastNotificationManager.CreateToastNotifier().Show(toastNotification);
    19         }
  • 相关阅读:
    一、Python概念知识点汇总
    在ubuntu永久添加alias
    字符串转化为数字 不用sscanf
    python class类
    《Effective C++》笔记
    问到面向对象该如何回答
    数字和字符串互相转换
    python input print 输入输出
    《c专家编程》笔记
    判断是否是回文数
  • 原文地址:https://www.cnblogs.com/includeling/p/4592816.html
Copyright © 2011-2022 走看看