How can I test the WP7 application in the absence of an Internet connection in the emulator?

I am developing a Windows Phone 7 application that can work without an Internet connection, but if necessary downloads some content from the Internet, if the network is available.

How can I test this application in Phone Emulator if there is no Internet connection?

There is a Settions option in the main menu, but unlike a real device, there is no way to disconnect a data connection. The only solution I came up with is to disable the WiFi adapter of my development laptop, but this seems to be the final option. Is there a way to make the emulator work in a disconnected environment?

+4
source share
4 answers

As you said, I will simply disconnect my development computer from the Internet when I want to test the wp7 application without an Internet connection. You cannot force it from the emulator, but you can probably disable it with the code, but that seems too big for me.

Another fooobar.com/questions/655511 / ....

From the WP7 App Hub .

+2
source

Another option is to use NetLimiter

Not only can you disconnect the connection to your application, you can change the speed to simulate a bad connection and see how your application behaves. NetLimiter and Fiddler are sweet tools.

+3
source

Check out the question . He has information about the same problem. Also check post .

You can use this method in your code to detect your Internet connection. If you put it in a static class as a static method, it works well.

 private bool InternetIsAvailable() { var available = !NetworkInterface.GetIsNetworkAvailable(); #if DEBUG available = false; #endif if (!available) { MessageBox.Show("No internet connection is available. Try again later."); return false; } return true; } 
+2
source

There is an easy way ...

If your application does not require an online login ... Desktop, go to "Internet Explorer"> "Settings"> "Connection" and configure the proxy server, which, of course, is invalid. Save the changes. You will no longer be able to browse the website. After these steps, run the simulator ...

0
source

Source: https://habr.com/ru/post/1395960/


All Articles