Ejemplo n.º 1
0
        /// <summary>
        /// 是否联网
        /// </summary>
        static bool IsConnect()
        {
            Int32 dwFlag = new int();
            bool  result = true;

            if (!InternetGetConnectedState(ref dwFlag, 0))
            {
                LogService.AppendInfoLog(typeof(App), "网络连接已断开...");
                result = false;
            }
            else if ((dwFlag & INTERNET_CONNECTION_MODEM) != 0)
            {
                LogService.AppendInfoLog(typeof(App), "网络已连接[调治解调器]...");
            }
            else if ((dwFlag & INTERNET_CONNECTION_LAN) != 0)
            {
                LogService.AppendInfoLog(typeof(App), "网络已连接[网卡]...");
            }
            return(result);
        }