Connection Monitor QuickStart

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
To create client business applications using current Microsoft technologies, see patterns & practices' Prism.

This QuickStart demonstrates the key usage scenarios of the Connection Monitor Application Block and how it reacts to network connection changes.

Building and Running the QuickStart

The QuickStart ships as source code, which means you must compile it before running it. This QuickStart does not require any additional setup.

To build and run the QuickStart

  1. Open the solution file Quickstarts.ConnectionMonitor.sln.
  2. On the Build menu, click Rebuild Solution.
  3. Enable Wireless LAN Connectivity in the machine where the QuickStart is being run.
  4. Press F5 to run the QuickStart.

Overview

The QuickStart consists of a single form that displays the connections and networks monitored by the Connection Monitor Application Block.

Ff699156.02930278-f758-4c28-989d-3427515e36ad(en-us,PandP.10).png

Figure 1

Connection Monitor QuickStart

Whenever a network connection change is detected, the list of networks and connections gets updated to reflect the change. The initial networks and connection are defined in the application configuration file, and you can add new connections and networks at runtime using the Add new connection and Add new network sections in the main form.

<ConnectionMonitor>
<Connections>
<add Type="WiredConnection" Price="2"/>
</Connections>
<Networks>
<add Name="Local" Address="http://127.0.0.1"/>
<add Name="Internet" Address="https://www.contoso.com"/>
</Networks>
</ConnectionMonitor>

To see the Connection Monitor Application Block reaction on connectivity changes

  1. Disable/enable your physical network adapter(s) or
  2. Add a desktop connection and right-click it to connect or disconnect it. For instructions on how to add a desktop connection, see the procedure To add a new connection.

You can programmatically add a new connection to be monitored by the block using the input controls in the Add new connection section.

To add a new connection

  1. In the Add new connection section, enter a name for the connection.
  2. Select a connection type. You can choose one of the following connection types:
    • DesktopConnection: represents a desktop connection. You can use a desktop connection to programmatically update its status (connected or disconnected) and explore the Connection Monitor Application Block reaction.
    • NicConnection: any network interface connection (Ethernet card, Wireless adapter, etc).
    • WiredConnection: represents a wired connection.
    • WirelessConnection: represents a wireless connection.
  3. Set a price for the connection.
  4. Click Add.

You can also add a new network to be monitored.

To add a new network

  1. In the Add new network section, enter a name for the network.
  2. Specify the network address.

Related Software Factory Assets

The following assets are related to this QuickStart:

  • Connection Monitor Application Block