Exemple #1
0
 public Task <Vpn[]> GetVpns()
 {
     return(Task.FromResult((
                                from name in RasApi32.RasEnumEntries()
                                let entry = RasApi32.RasGetEntryProperties(name.EntryName, name.PhonebookPath)
                                            where entry.DeviceType.ToLower() == "vpn"
                                            select new Vpn(entry.Id.ToString(), name.EntryName))
                            .ToArray()));
 }
        public Task Connect(string id)
        {
            var entryName = RasApi32.RasEnumEntries()
                            .FirstOrDefault(n => RasApi32.RasGetEntryProperties(n.EntryName, n.PhonebookPath).Id.ToString() == id);

            var dialParams = RasApi32.RasGetEntryDialParams(entryName.EntryName, entryName.PhonebookPath);

            RasApi32.RasDial(dialParams, entryName.PhonebookPath, (message, state, error) => { });

            return(Task.CompletedTask);
        }