以前说UWP 使用OneDrive云存储2.x api(二)【全网首发】,微识别实现了上传下载的功能,那么为了给用户更上一层楼的体验,那就是在上传下载完成以后,弹出一通知Notifications。html
关于Notifications,在UWP Community Toolkit中也有简单介绍,不过微软还除了一个更为强大的,api
专门介绍 Tiles 和 Notifications 的工具————Notifications Visualizeride
商店搜索便可下载,这个貌似没有源代码。不过也不须要了。由于里面各类样式均可以直接导出代码,供你直接拿来用。工具
很炫酷吧,不过我这里只是介绍一下这个工具,并结合个人实际例子来讲明spa
这是个人在上传完成后的通知,封装好了,放进去直接调用。code
我只加了一个 AdaptiveText(),能够加多个的。而且 ToastButton参数设置None了,就是点击 后消除通知。htm
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); }
不错吧,姿式有不少。总有一个知足你blog