zoukankan      html  css  js  c++  java
  • UWP 应用通知Notifications

    之前说UWP 使用OneDrive云存储2.x api(二)【全网首发】,微识别实现了上传下载的功能,那么为了给用户更上一层楼的体验,那就是在上传下载完成之后,弹出一通知Notifications。

    关于Notifications,在UWP Community Toolkit中也有简单介绍,不过微软还除了一个更为强大的,

    专门介绍 Tiles 和 Notifications 的工具————Notifications Visualizer

    商店搜索即可下载,这个貌似没有源代码。不过也不需要了。因为里面各种样式都可以直接导出代码,供你直接拿来用。

     

     很炫酷吧,不过我这里只是介绍一下这个工具,并结合我的实际例子来说明

     这是我的在上传完成后的通知,封装好了,放进去直接调用。

    我只加了一个 AdaptiveText(),可以加多个的。并且 ToastButton参数设置None了,就是点击 后消除通知。

    private void PopupToast(string strMainContent, string strButtonContent)
            {
                var toastContent = new ToastContent()
                {
                    Visual = new ToastVisual()
                    {
                        BindingGeneric = new ToastBindingGeneric()
                        {
                            Children =
                                {
                                    new AdaptiveText()
                                    {
                                        Text = strMainContent
                                    },
                                },
                            //AppLogoOverride = new ToastGenericAppLogo()
                            //{
                            //    Source = "https://unsplash.it/64?image=1005",
                            //    HintCrop = ToastGenericAppLogoCrop.Circle
                            //}
                        }
                    },
                    Actions = new ToastActionsCustom()
                    {
                        Buttons =
                            {
                                new ToastButton(strButtonContent, "None")
                                {
                                    ActivationType = ToastActivationType.Foreground
                                }
                            }
                    }
                };
    
                // Create the toast notification
                var toastNotif = new ToastNotification(toastContent.GetXml());
    
                // And send the notification
                ToastNotificationManager.CreateToastNotifier().Show(toastNotif);
            }

     不错吧,姿势有很多。总有一个满足你

  • 相关阅读:
    【Android】6.3 ProgressDialog
    【Android】6.2 AlertDialog(警告对话框)
    【Android】6.1 Toast(信息提示框)
    【Android】6.0 第6章 对话框--本章示例主界面
    【Android】5.8 滑动条(SeekBar)
    Storm Trident API
    Storm Trident状态
    Storm Trident详解
    Storm的并行度
    StormUI详解
  • 原文地址:https://www.cnblogs.com/hupo376787/p/8033996.html
Copyright © 2011-2022 走看看