|
using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Xml;
namespace NAst.Common
{
/// <summary>
/// Test if the MobilePC is connected to a network
/// </summary>
public class IsConnectedTester : INetworkTest
{
private bool _expectedValue = false;
#region INetworkTest Members
/// <summary>
/// Check if the current network availability
/// equals the expected availability.
/// </summary>
/// <returns></returns>
public bool Test()
{
return System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == _expectedValue;
}
public void Initialize(string stateName, XmlElement config)
{
string val = config.GetAttribute("value");
if (val.Equals("true", StringComparison.InvariantCultureIgnoreCase)
|| val.Equals("true", StringComparison.InvariantCultureIgnoreCase))
{
_expectedValue = true;
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.