Event Triggered Toast Notification UWP

橙三吉。 提交于 2019-12-20 04:12:17

问题


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?


回答1:


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 Enum

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

    Respond To System Event

You can then check if you want to show the toast by using Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile()

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



来源:https://stackoverflow.com/questions/40443150/event-triggered-toast-notification-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!