public bool Reconnect(VPNItem item)
        {
            if ((null == item))
            {
                LogManager.Error("VPN服务器参数获取出错!");
                return(false);
            }

            if (this.CurrentVpnItem != item)
            {
                this.CurrentVpnItem = item;
            }

            if (string.IsNullOrEmpty(this.CurrentVpnItem.EntryName) ||
                string.IsNullOrEmpty(this.CurrentVpnItem.IP) ||
                string.IsNullOrEmpty(this.CurrentVpnItem.User) ||
                string.IsNullOrEmpty(this.CurrentVpnItem.Password))
            {
                LogManager.Error("VPN 拨号参数不能为空");
                return(false);
            }
            if (!this.Reconnect())
            {
                return(false);
            }
            ReconnectManager.Sleep();
            //bool isConnected = CmdHelper.Ping(this.CurrentVpnItem.IP);
            //if (!isConnected)
            {
                // The connection attempt has completed, attempt to find the connection in the active connections.
                foreach (RasConnection connection in RasConnection.GetActiveConnections())
                {
                    if (connection.EntryName == this.CurrentVpnItem.EntryName)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        public bool Reconnect(DetectionParamsItem detectionItem)
        {
            if ((null != detectionItem) && (detectionItem.ReconnectType == ReconnectType.Router))
            {
                RouterItem routerItem = detectionItem.Router;
                LogManager.Info(string.Format("start restart router:{0}", routerItem.IP));
                RouterBase router = this.GetRouter(routerItem.RouterType);
                router.Reconnect(routerItem);
                ReconnectManager.Sleep();

                int i = 0;
                while (i++ < ReconnectManager.TRYCOUNT)
                {
                    if (CmdHelper.PingBaidu() || CmdHelper.Ping163())
                    {
                        return(true);
                    }
                    Thread.Sleep(2 * 1000);
                }
                return(false);
            }

            return(false);
        }