public NetInfo() { _backgroundWorker = new BackgroundWorker(); _backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; Statistics = new NetStatistics(this); NetLog.Init(this); }
private static void NetInfo_Connected(object sender, EventArgs e) { if (_lastDisconnect != null && DateTime.Now.Subtract(_lastDisconnect.LogTime) < RECONNECT_MAX_TIME) { _lastDisconnect.Update(string.Format(MSG_RECONNECTED, Math.Round(DateTime.Now.Subtract(_lastDisconnect.LogTime).TotalSeconds))); } else { Add(MSG_CONNECTED); } _lastDisconnect = null; }
private static void NetInfo_Disconnected(object sender, EventArgs e) { _lastDisconnect = new NetLog(MSG_DISCONNECTED); Add(_lastDisconnect); }
public static void Clear() { LogList.Clear(); _lastDisconnect = null; LogChanged?.Invoke(null, EventArgs.Empty); }
private static void Add(NetLog netLog) { LogList.Add(netLog); LogAdded?.Invoke(netLog, EventArgs.Empty); }