Ejemplo n.º 1
0
 // Invoke the Changed event; called whenever list changes
 internal virtual void OnChanged(NetworkSpeedEventArgs e)
 {
     if (NetworkSpeedUpdated != null)
     {
         NetworkSpeedUpdated(this, e);
     }
 }
Ejemplo n.º 2
0
        private void m_NetworkInfo_NetworkSpeedUpdated(object sender, NetworkSpeedEventArgs e)
        {
            readFromSharedMemory();
            checkMinsBeforeSleep();
            m_SleepController.Hibernate = sleepAssistData.Hibernate;
            if (e.resetSleepTimer)
            {
                m_SleepController.resetSleepTimer();
                sleepAssistData.TimeOfNetworkActivity = DateTime.Now;
            }
            sleepAssistData.trafficIn  = e.inboundSpeed;
            sleepAssistData.trafficOut = e.outboundSpeed;

            checkOtherDetectors();
            writeToSharedMemory();
        }
Ejemplo n.º 3
0
        private void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            inboundTraffic.Add(TrafficIn);
            outboundTraffic.Add(TrafficOut);

            while (inboundTraffic.Count > 60)
            {
                inboundTraffic.RemoveAt(0);
            }

            while (outboundTraffic.Count > 60)
            {
                outboundTraffic.RemoveAt(0);
            }

            NetworkSpeedEventArgs eventArgs = new NetworkSpeedEventArgs();

            eventArgs.inboundSpeed    = InboundSpeed;
            eventArgs.outboundSpeed   = OutboundSpeed;
            eventArgs.resetSleepTimer = shouldResetSleep();
            OnChanged(eventArgs);
        }