/// <summary>
        /// Occurs when the user clicks the Dial button.
        /// </summary>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="System.EventArgs"/> containing event data.</param>
        private void DialButton_Click(object sender, EventArgs e)
        {
            this.StatusTextBox.Clear();
            RasEntry entry = (RasEntry)gvEntries.SelectedRows[0].Tag;

            // This button will be used to dial the connection.
            //this.Dialer.EntryName = EntryName;
            this.Dialer.PhoneBookPath = RasPhoneBook.GetPhoneBookPath(RasPhoneBookType.AllUsers);
            this.Dialer.EntryName     = entry.Name;
            Program.logWriting("DialButton_Click - " + entry.Name);
            try
            {
                // Set the credentials the dialer should use.
                //this.Dialer.Credentials = new NetworkCredential("Test", "User");
                this.Dialer.Credentials = entry.GetCredentials();

                // NOTE: The entry MUST be in the phone book before the connection can be dialed.
                // Begin dialing the connection; this will raise events from the dialer instance.
                this.Dialer.DialAsync();

                // Enable the disconnect button for use later.
                this.DisconnectButton.Enabled = true;
            }
            catch (Exception ex)
            {
                this.StatusTextBox.AppendText(ex.ToString());
                Program.logWriting("DialButton_Click 异常 - " + ex.ToString());
            }
        }
        private void getPhoneEntries()
        {
            List <vpn_Entry> RemoteVpns = getRemoteVpn();

            this.AllUsersPhoneBook.Open();
            foreach (vpn_Entry vpn in RemoteVpns)
            {
                if (!this.AllUsersPhoneBook.Entries.Contains(vpn.Name))
                {
                    if (string.IsNullOrEmpty(vpn.vpnIP))
                    {
                        continue;
                    }
                    RasEntry re = RasEntry.CreateVpnEntry(vpn.Name, vpn.vpnIP,
                                                          RasVpnStrategy.PptpOnly,
                                                          RasDevice.Create("VPN_PPTP", RasDeviceType.Vpn));
                    re.EncryptionType = RasEncryptionType.Optional;
                    this.AllUsersPhoneBook.Entries.Add(re);
                    re.UpdateCredentials(new NetworkCredential(vpn.vpnID, vpn.vpnPW));
                    re.Update();
                }
                else
                {
                    RasEntry  re   = this.AllUsersPhoneBook.Entries[vpn.Name];
                    IPAddress tryP = null;
                    if (!string.IsNullOrEmpty(vpn.vpnIP))
                    {
                        IPAddress.TryParse(vpn.vpnIP, out tryP);
                    }
                    re.IPAddress   = tryP;
                    re.PhoneNumber = re.IPAddress == null?string.Empty:re.IPAddress.ToString();
                    NetworkCredential nc = re.GetCredentials();
                    nc.UserName = vpn.vpnID;
                    nc.Password = vpn.vpnPW;
                    re.UpdateCredentials(nc);
                    re.Update();
                }
            }
        }