public CPUUsageIndicatorControlMode(int intervalMs) { timer = new Timer(); timer.Elapsed += new ElapsedEventHandler(Tick); timer.Interval = intervalMs; perfCounter = new PerformanceCounter("Processor", "% Processor Time", "_Total"); currentColour = LEDColour.getLEDColour("WHITE"); }
// TODO add option to map usage to brighness private LEDColour mapUsageToColour(float utilisation) { if (utilisation <= 33) { return(LEDColour.getLEDColour("GREEN")); } else if (utilisation > 66) { return(LEDColour.getLEDColour("RED")); } else { return(LEDColour.getLEDColour("YELLOW")); } }