using System;
using System.Collections.Generic;
using System.Text;
using OpenNETCF.Net;
namespace Example{
class VPN
{
public Boolean connect()
{
try
{
ConnectionManager NetCon = new ConnectionManager();
ConnectionDetailCollection NetConDetColl = NetCon.GetConnectionDetailItems() ;
ConnectionDetail NetConDet = null;
foreach (ConnectionDetail cd in NetConDetColl)
{
if ((cd.ConnectionType == ConnectionType.VPN) &&
(cd.ConnectionSubType == ConnectionSubType.PPTP))
{
NetConDet = cd;
break;
}
}
if (NetConDet == null)
throw new Exception("No VPN network configured");
NetCon.Connect(NetConDet.DestinatonNetwork, true,
ConnectionMode.Synchronous);// Asynchronous);
return true;
}
catch(Exception ex)
{
return false;
}
finally
{
}
}
}
}