事件触发 Toast 通知 UWP [英] Event Triggered Toast Notification UWP

查看:38
本文介绍了事件触发 Toast 通知 UWP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想法:我正在为特定网络自动进行 wifi 登录,在该网络中,用户必须通过弹出警报应用程序之类的 Toast 通知来输入凭据,但不是暂停或关闭按钮,而是登录或注销.问题:如何在用户连接到特定 wifi 网络时立即触发 toast 通知?

Idea:I am automating wifi login for a particular network where user have to enter credentials by poping a toast notification like alarm app but instead of snooze or dismiss button there would be login or logout. Issue:How to trigger toast notification immediately when the user connect to a particular wifi network?

推荐答案

您需要使用由系统事件触发的后台任务 - 在您的情况下是 NetworkStateChanged 触发器.

You need to use a Background Task which is getting triggered by a System Event - in your case the NetworkStateChanged trigger.

  • 以下是可用触发器列表:

  • Here are a list of available triggers:

SystemTriggerType 枚举

这里是一个快速介绍如何响应这样的系统事件:

And here is a quick introduction how to respond to such a system event:

响应系统事件

然后您可以使用 Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile()

看这个问题 https://stackoverflow.com/a/32846558/5111904 或查找文档NetworkInformation 类以获取更多信息.

Look at this question https://stackoverflow.com/a/32846558/5111904 or look up the documentation of the NetworkInformation class for further information.

这篇关于事件触发 Toast 通知 UWP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆