处理互联网检查 [英] Handle internet check

查看:73
本文介绍了处理互联网检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动我的应用程序时,将显示启动屏幕,它应检查设备是否已连接到互联网.如果没有互联网连接,则应显示一个带有确定按钮的消息框.单击确定按钮后,应用程序将退出. 在那里它将显示主页.

When I start my application the splash screen is displayed and it should check if the device is connected to internet. If no internet connection it should display a message box with OK button.On click of OK button the application exits.If internet connection is there it will display the MainPage.

1.我想我应该在App.xaml中使用 NetworkInterface.NetworkInterfaceType ,但是在哪里进行检查以及如何处理同步呼叫?

1.I think I should use NetworkInterface.NetworkInterfaceType in App.xaml but where to make the check  and how to handle the synchronous call?

2.如何在单击消息框中的确定"按钮后退出应用程序?

2.Also how to exit the app on click of OK button in message box?

请帮助.

推荐答案

检查是否可以在互联网上看到特定页面(www.bing.com ,www.microsoft.com等)可能需要花费5到15秒以上的时间才能完成页面导航,而不会引发未处理的异常.  这可能是 拒绝提交申请.  可以更快地检查哪些网络设备处于活动状态,但是它不会告诉您是否可以访问互联网.  (您可以连接到W-LAN,并且只能访问该内部网络,而无需外部 网络访问.)

A check to see if you can see a particular page on the internet (www.bing.com, www.microsoft.com, etc.) may take more than the 5 or 15 seconds that a page has to complete navigation to without throwing an unhandled exception.  This can be a reason to reject an application submission.  There are quicker checks to see which network devices are active, but it will not tell you if you have internet access.  (You can be connected to a W-LAN and only have access on that internal network with no external network access.)

如果对应用程序所需站点的网络访问检查失败,并且您发现您无权访问,则可以使用NavigationServices.GoBack()调用尝试退出该应用程序,但这不是一个好主意.也可以导致认证 问题.

If your check for network access to a required site for your application fails and you see that you have no access you can use a NavigationServices.GoBack() call to try and exit the application, but this is a bad idea as it also can lead to certification issues. 

最好是在初始屏幕后打开您的起始页,然后在看到网络访问权限后激活应用程序功能.  

Better would be to open your start page after the splash screen and then activate application features once you see you have the network access.  


这篇关于处理互联网检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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