//using GVL;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace HBLConsole.Service
{
///
/// 其它通用库
///
public class UniversalHelper
{
private volatile static UniversalHelper _Instance;
public static UniversalHelper GetInstance => _Instance ?? (_Instance = new UniversalHelper());
private UniversalHelper() { }
[DllImport("wininet")]
//判断网络状况的方法,返回值true为连接,false为未连接
public extern static bool InternetGetConnectedState(out int conState, int reder);
///
/// 获取当前网络连接状态
///
/// 成功连接网络返回 true,未连接返回 false
public bool GetNetworkState()
{
return InternetGetConnectedState(out int i, 0);
}
public void Init()
{
//while (!GVL_VAR.GetInstance.NetworkConnectState)
//{
// //GVL_VAR.GetInstance.NetworkConnectState = GetNetworkState();
// Thread.Sleep(1000);
//}
//ThreadManagerment.GetInstance.StartLong(new Action(() =>
//{
// //GVL_VAR.GetInstance.NetworkConnectState = GetNetworkState();
// Thread.Sleep(1000);
//}), "网络监听状态");
}
}
}