zoukankan      html  css  js  c++  java
  • UWP 系统通知测试

    code:

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Runtime.InteropServices.WindowsRuntime;
    using System.Data;
    using Windows.Foundation;
    using Windows.Foundation.Collections;
    using Windows.UI.Notifications;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Controls.Primitives;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Input;
    using Windows.UI.Xaml.Media;
    using Windows.UI.Xaml.Navigation;
    using Windows.Data.Xml.Dom;
    
    // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
    
    namespace App3
    {
        /// <summary>
        /// An empty page that can be used on its own or navigated to within a Frame.
        /// </summary>
        public sealed partial class MainPage : Page
        {
            public MainPage()
            {
                this.InitializeComponent();
             
            }
    
            private void ShowToast()
            {
                string title = "featured picture of the day";
                string content = "beautiful scenery";
                string image = "https://preview.qiantucdn.com/original_origin_pic/19/03/05/ad08d2302706e9f8d8b64b5ab0c3b23b.png!qt324new_nowater_webp";
                string logo = "https://preview.qiantucdn.com/original_origin_pic/19/03/05/e2c60d1317f3019ce20919b0ec568082.png!qt324new_nowater_webp";
                
                string xmlString =
                $@"<toast><visual>
           <binding template='ToastGeneric'>
           <text>{title}</text>
           <text>{content}</text>
           <image src='{image}'/>
           <image src='{logo}' placement='appLogoOverride' hint-crop='circle'/>
           </binding>
          </visual></toast>";
    
                XmlDocument toastXml = new XmlDocument();
                toastXml.LoadXml(xmlString);
    
                ToastNotification toast = new ToastNotification(toastXml);
    
                ToastNotificationManager.CreateToastNotifier().Show(toast);
            }
    
            private void Button_Click(object sender, RoutedEventArgs e)
            {
                ShowToast();
            }
        }
    }
    

      

    其他APP 好像也可以调用这种系统特性(需要引入必要的引用):

    https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-enhance

  • 相关阅读:
    【总结整理】javascript的函数在if中调用时是否加括号---与.net的不同之处
    【总结整理】javascript的函数调用时是否加括号
    【总结整理】JavaScript的DOM事件学习(慕课网)
    关于overflow:hidden (转)
    CSS
    HTML
    jQuery
    函数
    装饰器
    python的条件与循环1
  • 原文地址:https://www.cnblogs.com/wgscd/p/12971010.html
Copyright © 2011-2022 走看看