示例#1
0
        public NetInfo()
        {
            _backgroundWorker = new BackgroundWorker();
            _backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            Statistics = new NetStatistics(this);
            NetLog.Init(this);
        }
示例#2
0
        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;
        }
示例#3
0
 private static void NetInfo_Disconnected(object sender, EventArgs e)
 {
     _lastDisconnect = new NetLog(MSG_DISCONNECTED);
     Add(_lastDisconnect);
 }
示例#4
0
 public static void Clear()
 {
     LogList.Clear();
     _lastDisconnect = null;
     LogChanged?.Invoke(null, EventArgs.Empty);
 }
示例#5
0
 private static void Add(NetLog netLog)
 {
     LogList.Add(netLog);
     LogAdded?.Invoke(netLog, EventArgs.Empty);
 }